Difference between __init__ (again) and nothing ...
Stef Mientki
S.Mientki-nospam at mailbox.kun.nl
Tue Jan 2 06:50:57 EST 2007
Marc 'BlackJack' Rintsch wrote:
> In <da749$459a380d$d443bb3a$16845 at news.speedlinq.nl>, Stef Mientki wrote:
>
>> What's the difference between using __init__ and using nothing,
>> as the examples below.
>>
>> class cpu:
>> PC = 4
>
> This is a *class attribute*. It's the same for all instances of `cpu`.
>
>> class cpu:
>> def __init__:
>> self.PC = 4
>
> This is an *instance attribute* which is set in every instance of `cpu`.
>
thanks Marc,
Oh so obvious, why didn't I discovered that myself ;-)
cheers,
Stef
More information about the Python-list
mailing list