[Python-3000] Metaclasses in Py3K
Talin
talin at acm.org
Sat Dec 16 21:38:09 CET 2006
Phillip J. Eby wrote:
> At 11:30 AM 12/16/2006 -0800, Talin wrote:
>> The general idea is to have the metaclass create a mapping object which
>> is used as the 'locals' dictionary for the suite following the class
>> statement. There would be some special-named function of the metaclass,
>> such as '__metadict__', which would construct a new mapping object. I
>> haven't seen many alternative proposals to this.
>
> There's mine, where you simply create mcls(name, bases, {}) and then map
> locals operations to get/set/delattr operations on the class. This
> would presumably be done using a simple mapping proxy, but it would be a
> built-in type rather than the user having to implement their own mapping
> type.
I'm not sure I entirely understand this. I did think about the idea of
defining special get/set methods on the class, but everything I came up
with was more complicated than just creating a special locals dict. The
main issue for me is that I think that its important to distinguish
between get/set operations that are done at class definition time, and
get/set operations that are done later, after the class is created.
-- Talin
More information about the Python-3000
mailing list