__init__ explanation please

Jeroen Ruigrok van der Werven asmodai at in-nomine.org
Sun Jan 13 05:46:41 EST 2008


-On [20080113 01:41], Erik Lind (elind at spamcop.net) wrote:
>I'm new to Python, and OOP. I've read most of Mark Lutz's book and more 
>online and can write simple modules, but I still don't get when __init__ 
>needs to be used as opposed to creating a class instance by assignment.

I personally tend to see __init__ or __new__ as equivalent to what other
languages call a constructor.

(And I am sure some people might disagree with that. ;))

-- 
Jeroen Ruigrok van der Werven <asmodai(-at-)in-nomine.org> / asmodai
イェルーン ラウフロック ヴァン デル ウェルヴェン
http://www.in-nomine.org/ | http://www.rangaku.org/
The riddle master himself lost the key to his own riddles one day, and
found it again at the bottom of his heart.



More information about the Python-list mailing list