no return values for __init__ ??

Samuel A. Falvo II kc5tja at garnet.armored.net
Thu Jan 6 15:19:12 EST 2000


In comp.lang.python, you wrote:
>Notably removing the constraint in the interpreter doesn't affect
>existing Python code ! This is what I wonder about. The interpreter was
>apparently restricted intentionally in this regard and I wonder what
>lead to this decision.

Because __init__() is a constructor; it is called _after_ the object is
already allocated and minimally initialized.  So when __init__( self, ... )
is called, "self" already contains a reference to the object which you are
initializing.

It is not __init__()'s job to allocate the object.

-- 
KC5TJA/6, DM13, QRP-L #1447
Samuel A. Falvo II
Oceanside, CA




More information about the Python-list mailing list