Hi,
I want to reference a class itself in its body:
class SomeElement(obj ect):
def __init__(self, mycontainer):
self.mycontaine r=mycontainer
class SomeContainer(o bject):
a = SomeElement(Som eContainer)
Unfortunatly this does not work since the name SomeContainer is not
definied at class creation time of SomeContainer:
/tmp/python-9309vMe.py in SomeContainer()
4
5 class SomeContainer(o bject):
----6 a = SomeElement(Som eContainer)
7
8
NameError: name 'SomeContainer' is not defined
How to do this?
Unfortunatly the obvious:
class SomeContainer(o bject):
def __init__(self):
self.a = SomeElement(Som eContainer)
is not possible because of other constraints.
--
Servus, Gregor
I want to reference a class itself in its body:
class SomeElement(obj ect):
def __init__(self, mycontainer):
self.mycontaine r=mycontainer
class SomeContainer(o bject):
a = SomeElement(Som eContainer)
Unfortunatly this does not work since the name SomeContainer is not
definied at class creation time of SomeContainer:
/tmp/python-9309vMe.py in SomeContainer()
4
5 class SomeContainer(o bject):
----6 a = SomeElement(Som eContainer)
7
8
NameError: name 'SomeContainer' is not defined
How to do this?
Unfortunatly the obvious:
class SomeContainer(o bject):
def __init__(self):
self.a = SomeElement(Som eContainer)
is not possible because of other constraints.
--
Servus, Gregor
Comment