Question on default value of __init__

Bernie bernie at
Mon Nov 19 10:40:35 CET 2001

Hello all,

When I run, an instance of foo is created.  Is this the default behavior 
in Python for default value?  i.e. The value must be exist as an object.  Are 
there any way to delay the creation of foo() until bar() is created.


    class foo:
        def __init__( self, param=None):
            print 'executed!'
	    self.__param = param

        def __nonzero( self):
            if self.__param:
                return 1
                return 0

    class bar:
        def __init__( self, param=foo()):
            assert isinstance( param, foo), '"in" must be an instance of foo'

More information about the Python-list mailing list