Hi, I'm working on a project where we're juggling with two potential implementations. In the two scenarios, we create objects in the base namespace. These objects are interdependent, in the sense that to compute something, they have to look up the value of the other objects (their parents). The objects are functions, by the way, with some additional attributes.
In the first scenario, as the objects are created, they immediately share references and can call each other's value. All these objects are then referenced in a class that defines some methods accessing those objects. The advantage is that you can call the functions from the base namespace and they'll know where to look to make the computations. The downsize is that if you delete one object by mistake, nothing works anymore, that is, the methods from the class will no longer reference the right objects. In the second scenario, as the objects are created, they only know the name of their parents, and don't have their actual reference. To compute something, we have to pass the values of the other objects explicitely. A class is then instantiated, where we look up the __main__ dictionary for the names of the parents given by each function, copy the objects inside the class, create an attribute for each object on the fly and link the objects together using the parents names. The advantage is that even if an object in the base namespace is destroyed, the class methods will still work since the references are all internal to the class instance. The disadvantage is that the objects in the base namespace are dummy objects, ie they don't speak to each other. I guess it's hard to understand the context from this quick description, but the code would look equally opaque. Here is an attempt to put that into a simple question: Are there counter indications to reference objects in the base namespace from a class ? Thanks for your help. David Huard -- http://mail.python.org/mailman/listinfo/python-list