K
Kooks are people too
If I try this:
class A:
someType = B
class B:
anotherType = A
I get:
<type 'exceptions.NameError'>: name 'B' is not defined
args = ("name 'B' is not defined",)
message = "name 'B' is not defined"
Presumably because I'm instantiating an instance of a type object (B)
that doesn't exist yet.
Is there any way to do this?
Why I'd want to do this actually has to do with Google's datastore
api. I'm doing something similar to this:
from google.appengine.ext import db
class A:
aB = db.ReferenceType(B)
class B:
anA = db.ReferenceType(A)
class A:
someType = B
class B:
anotherType = A
I get:
<type 'exceptions.NameError'>: name 'B' is not defined
args = ("name 'B' is not defined",)
message = "name 'B' is not defined"
Presumably because I'm instantiating an instance of a type object (B)
that doesn't exist yet.
Is there any way to do this?
Why I'd want to do this actually has to do with Google's datastore
api. I'm doing something similar to this:
from google.appengine.ext import db
class A:
aB = db.ReferenceType(B)
class B:
anA = db.ReferenceType(A)