On Sep 18, 3:31 pm, alex23 <[email protected]> wrote:
> On Sep 18, 3:08 pm, rantingrick <[email protected]> wrote:
>
> > ok here is some code. this will cause an infinite recursion.
>
> > class A():
> > def __init__(self, *args):
> > self.nestedA = A(*args) #NO GOOD!
>
> How about:
>
> class A(object):
> def __init__(self, first=True, *args):
> if first:
> self.nestedA = A(first=False, *args)
>
> That's about the only way I can see you easily avoiding the
> recursiveness.
Only, y'know, with the right indentation:
class A(object):
def __init__(self, first=True, *args):
if first:
self.nestedA = A(first=False, *args)
--
http://mail.python.org/mailman/listinfo/python-list