Beginning Question about Python functions, parameters...

Bruno Desthuilliers bruno.42.desthuilliers at websiteburo.invalid
Wed Nov 25 03:24:02 EST 2009


astral orange a écrit :
> On Nov 23, 10:37 pm, r <rt8... at gmail.com> wrote:
(snip)
>> This is a horrible example to show noobs. I think the OP could better
>> understand this as a class EVEN though the OP may or may not know what
>> a class *is* yet.
>>
>>>>> class Name():
>>         def __init__(self, first, middle, last):
>>                 self.first = first
>>                 self.middle = middle
>>                 self.last = last
>>
(snip)

> As for the "class Name():" example above? Even though I haven't seen
> exactly what purpose 'self' serves

It's a reference to the current Name instance. But while technically 
correct, I'm sure such this kind of explanation really helps :-/




More information about the Python-list mailing list