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


Groups > comp.lang.python > #13311

method:wrong structure

From "守株待兔" <1248283536@qq.com>
Subject method:wrong structure
Date 2011-09-15 16:28 +0800
Newsgroups comp.lang.python
Message-ID <mailman.1154.1316075346.27778.python-list@python.org> (permalink)

Show all headers | View raw


[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 comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web