Circular import

Frank V. Castellucci frankc at colconsulting.com
Sun Jun 18 15:16:59 EDT 2000


With the assumption that class A and class B reference each other, how
do you avoid the Python error with:

---------- Composite.py -----------

from Leaf import Leaf

class Composite:
	def __init__( self ):
		self.__theLeaf = Leaf(self)

-------- Leaf.py --------------

from Composite import Composite

class Leaf:
	def __init__( self, aComposite ):
		self.__theComposite = aComposit



------------------------------

		
-- 
Frank V. Castellucci



More information about the Python-list mailing list