Recursive constructors?
Stidolph, David
stidolph at origin.ea.com
Fri Jul 30 13:46:44 EDT 1999
Of course it is ok to call recursively. self.bar will contain a different
instance of class foo. Never had to write this, but shouldn't be any kind
of problem. Make sure you have initialized the class first of course.
-----Original Message-----
From: roy at endeavor.med.nyu.edu [mailto:roy at endeavor.med.nyu.edu]
Sent: Friday, July 30, 1999 12:18 PM
To: python-list at cwi.nl
Subject: Recursive constructors?
Is it legal for a constructor function to call itself recursively? I.e.:
class foo:
def __init__(self, x):
if (whatever):
self.bar = foo(y)
--
Roy Smith <roy at popmail.med.nyu.edu>
New York University School of Medicine
More information about the Python-list
mailing list