From: Norbert N. <Nor...@gm...> - 2005-01-27 11:17:12
|
Am Donnerstag 27 Januar 2005 10:16 schrieb Ivan Vilata i Balaguer: > Actually, it is possible for Group to use _f_create* methods and have no > knowledge of which kinds of nodes it supports. One could register and > deregister new Node classes into Group in this way: > > class MyNewLeaf(Leaf): > ... class definition ... > Group._f_registerNode(MyNewLeaf) > > The _f_create* method would be created on-the-fly.... Maybe it is just me personally, but I find this kind of library-design extremely confusing. Of course, Python allows an extremely flexible design of libraries that would never be possible in other languages (my personal background is mostly C++). This flexibility calls for a lot of self-discipline. My usual idea of a library is, that it is a fixed set of modules, containing a fixed set of classes offering a fixed set of methods. Any departure from this static picture means an additional step in understanding the library. It may be justified in many cases, but should still be avoided if there is no good reason for it. Anyway: this is just my personal view as someone relatively new to Python... Ciao, Norbert -- _________________________________________Norbert Nemec Bernhardstr. 2 ... D-93053 Regensburg Tel: 0941 - 2009638 ... Mobil: 0179 - 7475199 eMail: <No...@Ne...> |