On 18/01/12 02:13, Stayvoid wrote:
class A:
def __init__(self, data):
self.data = data
print self.data
I'm trying to understand this function-like syntax:
A('foo').__init__(42)
You would not normally call any method with a double underscore
pre/poist f
On 01/17/2012 09:13 PM, Stayvoid wrote:
Hello!
Here is another one.
class A:
def __init__(self, data):
self.data = data
print self.data
I'm trying to understand this function-like syntax:
A('foo').__init__(42)
A(12).data
What are we actually calling thi
Hello!
Here is another one.
class A:
def __init__(self, data):
self.data = data
print self.data
I'm trying to understand this function-like syntax:
A('foo').__init__(42)
A(12).data
What are we actually calling this way?
Are there any other ways to get the
Thanks.
I totally get it now.
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
On Sun, Jan 1, 2012 at 8:40 PM, Stayvoid wrote:
> Hi there!
>
class Sample:
def method(self): pass
>
Sample().method()
>
> What's the difference between class __main__.Sample and
> __main__.Sample instance?
> Why should I write "Sample().method" instead of "Sample.method"?
>
Th
Hi there!
>>> class Sample:
>>> def method(self): pass
>>> Sample().method()
What's the difference between class __main__.Sample and
__main__.Sample instance?
Why should I write "Sample().method" instead of "Sample.method"?
Cheers!
___
Tutor mail