Those look like use cases for metaclasses, but I don't see how they require setting a custom dict *while the class suite is being executed*. The metaclass can create a new dict from its dict argument and use the new dict to construct the class.
On 3/9/07, Jim Jewett <[EMAIL PROTECTED]> wrote: > On 3/8/07, Talin <[EMAIL PROTECTED]> wrote: > > > First, there is a purely cosmetic argument about how metaclasses ought > > to be specified syntactically, which I won't go into in any detail. Most > > of the proposals centered around what I will call 'Class Definition > > Keyword Arguments' (CDKA), in other words keyword arguments that are > > passed in along with the list of base classes. > > You need to in the PEP though, particularly since class decorators are > now available. (These remove the need for some of the existing > metaclass usage.) > > > ... a means to > > supply a custom, dictionary-like object that would be used to collect > > the class member definitions as the class was being evaluated. > > ... > > > Now, it was pointed out that the only use cases for a custom dictionary > > that anyone could think of were all about preserving the ordering of > > declarations. > > Not quite true. > > (1) immutable class dictionaries. These are typical for extension > classes, but a real pain for python classes. > > (2) almost-immutable -- with callbacks when values are > added/changed/deleted. PJE just pointed out that doing this on even > just the __bases__ attribute could make generic functions safer. > > (3) actually-private variables > > -jJ > -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
