basic grammer error..

Dave Angel davea at ieee.org
Wed Dec 16 11:10:43 EST 2009


codefly wrote:
> class codefly:
>
>      def WaitFreecatz(self, hours):
>          hours = self.hours
>          i = 1
>          while i < hours:
>               print 'i wait %s hours' %(i)
>               i = i+1
>          if i == hours:
>               print '\nhe never comes'
>
>
> run error// what's wrong??
>
>   
You can't get a runtime error there, because nothing instantiates the 
class, nor calls its method.  Once you add that code, you'll find an 
uninitialized instance attribute, plus a couple of logic errors.

So, if you actually have a question, how about stating it completely?   
Given a complete code sample, you run it (on what version of what 
computer language, on what OS), and you get some error (show complete 
traceback).  Explain what you tried, to identify the error, and then 
state what has you stumped.

And if you don't get a Python error, but get the wrong results, then 
state what you expected, and what you got.

DaveA




More information about the Python-list mailing list