method:wrong structure

守株待兔 1248283536 at qq.com
Thu Sep 15 10:28:51 CEST 2011


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)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110915/9f79b2c8/attachment.html>


More information about the Python-list mailing list