initializing mutable class attributes

Aahz aahz at pythoncraft.com
Tue Aug 31 02:57:52 CEST 2004


In article <mailman.2624.1093889688.5135.python-list at python.org>,
Shalabh Chaturvedi  <shalabh at cafepy.com> wrote:
>
>In Python you either have an __init__ or you don't. There is no 'default 
>constructor' - or if there is, it does nothing. 

Actually, that's not quite true.  Python does indeed have a default
constructor that returns the object.  This isn't particularly visible
from classic classes because there's no way to get access to a
constructor.  New-style classes make the constructor available through
__new__().  __init__() is an initializer.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"To me vi is Zen.  To use vi is to practice zen.  Every command is a
koan.  Profound to the user, unintelligible to the uninitiated.  You
discover truth everytime you use it."  --reddy at lion.austin.ibm.com



More information about the Python-list mailing list