Basic class implementation question

Henry Chang goldspin at gmail.com
Wed Apr 2 00:53:34 EDT 2008


Try this.

class wontwork:
       def really(self):
               print "Hello World"

wontwork().really()

On Tue, Apr 1, 2008 at 9:43 PM,  <hexusnexus at gmail.com> wrote:
> I can't get call a class for some reason.  This must be one of those
>  newbie questions I hear so much about:
>
>  class wontwork:
>         def really():
>                 print "Hello World"
>
>  wontwork.really()
>
>  This returns (as an error):
>
>  Traceback (most recent call last):
>   File "<pyshell#4>", line 1, in <module>
>     wontwork.really()
>  TypeError: unbound method really() must be called with wontwork
>  instance as first argument (got nothing instead)
>
>  Any ideas?
>  --
>  http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list