class of a class problem

CipoFuzo cipofuzo at home.com
Mon May 12 18:16:05 EDT 2003


Hello,

I'm trying to define a class inside of a class
and it doesn't work:

class A:
	class B:
		pass               
	def __init__(self):
		self.element = B()

test = A()

NameError: global name 'B' is not defined



Why do I get a namerror? Why is python looking for B in
the global namespace?

Thanks,
Cipo


 
 




More information about the Python-list mailing list