Recursive constructors?

Bruce Dodson bruce_dodson at bigfoot.com
Fri Jul 30 14:16:44 EDT 1999


It is legal, but you had better make sure that (whatever) becomes false
somewhere along the line, as a side-effect of foo::__init__.  Otherwise, I
pity the foo at the bottom, who has to carry an entire heap full of bars.
(okay,okay)

>class foo:
>   def __init__(self, x):
>      if (whatever):
>         self.bar = foo(y)






More information about the Python-list mailing list