You want a method in a base class to parse input and create instances of certain derived classes. Your sample code looks like: if some_condition_on_chunk_contents: node = Node1(chunk_contents) else: node = Node2(chunk_contents)
I'd suggest changing the method to use a variable to determine the class. Following your pattern of coding: #Toolkit.py class Tree: node1 = Node1 node2 = Node2 ... class Node1(Node): ... #Application.py class Tree(Toolkit.Tree): node1 = Node1 node2 = Node2 ... class Nodes(Node,Toolkit.Node1): ... if some_condition_on_chunk_contents: node = self.node1(chunk_contents) else: node = self.node2(chunk_contents) This requires that the class constructors be similar enough so that they take the same parameters. It is also a manual effort to keep the node assignments in Tree in sync with the Node classes that you write. You also face a similar issue keeping Application.py and Toolkit.py in sync. -- Lloyd Kvam Venix Corp _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor