看板 [ Python ]
討論串[問題] Class如何決定method
共 2 篇文章
首頁
上一頁
1
下一頁
尾頁

推噓1(1推 0噓 1→)留言2則,0人參與, 最新作者sandaniel (喵喵喵)時間13年前 (2012/04/25 14:51), 編輯資訊
0
0
0
內容預覽:
自問自答. self.__getattribute__(varname)(p). --. 發信站: 批踢踢實業坊(ptt.cc). ◆ From: 125.230.192.150.

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者sandaniel (喵喵喵)時間13年前 (2012/04/25 14:31), 編輯資訊
0
0
0
內容預覽:
class AAA(object):. def A1(self,p):. return p*1. def A2(self,p):. return p*2. def CTRL(self,index,p):. varname = 'A'+str(index). return self.varname(p
(還有23個字)
首頁
上一頁
1
下一頁
尾頁