Re: [Tutor] Class vs. instance

2012-01-18 Thread Alan Gauld
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

Re: [Tutor] Class vs. instance

2012-01-17 Thread Dave Angel
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

Re: [Tutor] Class vs. instance

2012-01-17 Thread Stayvoid
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

Re: [Tutor] Class vs. instance

2012-01-01 Thread Stayvoid
Thanks. I totally get it now. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Class vs. instance

2012-01-01 Thread Hugo Arts
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

[Tutor] Class vs. instance

2012-01-01 Thread Stayvoid
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