Hi > Also, I gave the example using Python code as 'config' format, but any > structured enough text format could do, ie JSON, XML, or even ini-like: > > # schema.ini > objects = turbine1, frobnicator2 > > [turbine1] > class=Turbine > upstream=frobnicator2 > downstream= >
yes, I like the idea of using .ini type file format or XML, very much. There are parser available which will automatically building python objects from this, won't they (like configparser)? I'll have to get reading over the weekend... > >>def get_class_by_name(name): > >> return globals()[name] > > > > Q&D way to retrieve the class object (Python's classes are themselves > objects) known by it's name (as a string). ok, so it actually returns the class object itself. One thing that confuses me is that objects have a name (self.name) but object instances also have a name (e.g. myspecialturbine = turbine(...) ---- how do I discover the name 'myspecialturbine' ?). And object instances have a class name too ('turbine'). Aaargh, too many names! what if just want to know what the name of the instance is (in this case 'myspecialturbine'?) Right. I'll have a go at pulling all this together over the weekend hopefully. Hurrah! Thanks for all the help, to everyone. Dave -- http://mail.python.org/mailman/listinfo/python-list