Basic class implementation question

H

hexusnexus

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?
 
H

Henry Chang

Try this.

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

wontwork().really()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top