From: Ivan V. i B. <iv...@ca...> - 2005-01-27 15:00:23
|
On Thu, Jan 27, 2005 at 12:17:01PM +0100, Norbert Nemec wrote: > 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.... >=20 > Maybe it is just me personally, but I find this kind of library-design=20 > extremely confusing. Of course, Python allows an extremely flexible desig= n of=20 > libraries that would never be possible in other languages (my personal=20 > background is mostly C++). This flexibility calls for a lot of=20 > self-discipline. If I may say, I only see one text line of self-discipline. ;) For me, it is not confusing at all, and it leverages the power of Python introspection and dynamic binding. >=20 > My usual idea of a library is, that it is a fixed set of modules, contain= ing a=20 > fixed set of classes offering a fixed set of methods. Any departure from = this=20 > static picture means an additional step in understanding the library. It = may=20 > be justified in many cases, but should still be avoided if there is no go= od=20 > reason for it. Yes, you are completely right. However, when *extending* the library we are changing the library =E2=80=9Cblack-box=E2=80=9D approach (which is sti= ll valid for users) for a framework =E2=80=9Cwhite-box=E2=80=9D approach (where develope= rs have access to some internal aspects). Registering new classes in a framework is not that strange (and believe me, it could have been *much* worse). >=20 > Anyway: this is just my personal view as someone relatively new to Python= =2E.. And it is a very interesting one. Please, don't hesitate to show your opinions about PyTables (that goes for everyone). They are very valuable to us. Regards, Ivan --=20 Ivan Vilata i Balaguer >qo< http://www.carabos.com/ C=C3=A1rabos Coop. V. V V Enjoy Data "" |