[Python-3000] Metaclasses in Python 3000: Draft 2

Phillip J. Eby pje at telecommunity.com
Wed Mar 14 17:15:39 CET 2007


At 08:49 PM 3/14/2007 +1300, Greg Ewing wrote:
>Talin wrote:
> >      It does not need to implement the full dictionary interface;
> >      only the ability to insert items and retrieve them are
> >      required. (Note: double check that this is true).
>
>Deletion ability might be required as well, in case
>del is used in the class body.

Right, and some weird metaclasses might only need the ability to set, or 
only the ability to get.  (Actually, 90%+ of today's classes could get by 
with just setting, and no getting or deleting.)

So the subset required is determined entirely by what the class body (and 
metaclass __new__) require.

It should probably be noted that type.__new__ is still going to want a 
*real* dictionary, which it will then proxy.  So the metaclass' __new__ is 
going to need to read out the contents of the pseudo-dict somehow, or 
generate alternative contents.



More information about the Python-3000 mailing list