Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #13311 > unrolled thread

method:wrong structure

Started by"守株待兔" <1248283536@qq.com>
First post2011-09-15 16:28 +0800
Last post2011-09-15 16:28 +0800
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  method:wrong  structure "守株待兔" <1248283536@qq.com> - 2011-09-15 16:28 +0800

#13311 — method:wrong structure

From"守株待兔" <1248283536@qq.com>
Date2011-09-15 16:28 +0800
Subjectmethod: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)

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web