making a class return None from __init__

Aahz aahz at pythoncraft.com
Fri Oct 4 19:47:00 EDT 2002


In article <3D9E0E80.36F8E03D at alcyone.com>,
Erik Max Francis  <max at alcyone.com> wrote:
>
>The proper way to handle this case is to raise an exception from the
>constructor if something goes wrong.  

__init__() is *NOT* a constructor, it's an initializer.  If you want a
constructor, inherit from object and use __new__().
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

Project Vote Smart: http://www.vote-smart.org/



More information about the Python-list mailing list