[Tutor] how to instantiate a class
Lie Ryan
lie.1296 at gmail.com
Thu Feb 26 08:22:32 CET 2009
On Thu, 26 Feb 2009 12:38:27 +0530, Abhishek Kumar wrote:
> hello list,
>
You need to read through the tutorial first: http://docs.python.org/
tutorial/
If there are still things you don't understand, please ask again.
As for your question, here is a sample useless python code:
class MyClass(object):
def __init__(self, arg):
self.a = arg
def foo(self, b):
return self.a + b
myinstance = MyClass(5)
print myinstance.foo(6)
# output
11
More information about the Tutor
mailing list