Josiah Carlson wrote:
>> 2) What should the interface on the metaclass look like.
>>
>> 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.
>
> Proposal: don't make it a callable on the metaclass. It forces
> metaclasses into being classes, which I think is overly restrictive, or
> it forces people to do things like...
>
> def mymeta(...):
> ...
>
> mymeta.__metadict__ = mydict
I suppose you could make the new syntax require a callable that returns
a tuple of a dict and a finishing function, i.e.:
def mymeta( ... ):
def finish( dict ):
...
return finish, {}
class Foo( metaclass=mymeta ):
...
-- Talin
_______________________________________________
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