Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #13311 > unrolled thread
| Started by | "守株待兔" <1248283536@qq.com> |
|---|---|
| First post | 2011-09-15 16:28 +0800 |
| Last post | 2011-09-15 16:28 +0800 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
method:wrong structure "守株待兔" <1248283536@qq.com> - 2011-09-15 16:28 +0800
| From | "守株待兔" <1248283536@qq.com> |
|---|---|
| Date | 2011-09-15 16:28 +0800 |
| Subject | method:wrong structure |
| Message-ID | <mailman.1154.1316075346.27778.python-list@python.org> |
[Multipart message — attachments visible in raw view] — view raw
there are three programs,all of them left main structure,
code0 is ok,i don't know why code2 and code3 can't run,how to fix them?
code0
class webdata(object):
def __init__(self,arg):
def loadequity(self):
def loadoption(self):
#loadstatus={'equity':self.loadequity(),'option':self,loadoption()}
def run(self):
if __name__=="__main__":
s=webdata('equity').run()
s.loadequity()
code1
class webdata(object):
def __init__(self,arg):
def loadequity(self):
def loadoption(self):
loadstatus={'equity':self.loadequity(),'option':self,loadoption()}
def run(self):
if __name__=="__main__":
s=webdata('equity').run()
loadstatus['equity']
wrong output is
name 'self' is not defined
code2
class webdata(object):
def __init__(self,arg):
def loadequity(self):
def loadoption(self):
loadstatus={'equity':loadequity(),'option':loadoption()}
def run(self):
if __name__=="__main__":
s=webdata('equity').run()
s.loadequity()
wrong output is :
TypeError: loadequity() takes exactly 1 argument (0 given)
Back to top | Article view | comp.lang.python
csiph-web