[Python-3000] PEP for Metaclasses in Python 3000
Steven Bethard
steven.bethard at gmail.com
Tue Mar 13 04:45:26 CET 2007
On 3/12/07, Phillip J. Eby <pje at telecommunity.com> wrote:
> At 09:32 PM 3/12/2007 -0600, Steven Bethard wrote:
> >On 3/12/07, Steven Bethard <steven.bethard at gmail.com> wrote:
> > > the signature of the method called will be::
> > > __prepare__(name, args, kwargs)
> > > not
> > > __prepare__(name, *args, **kwargs)
> > > right?
> >
> >On 3/12/07, Guido van Rossum <guido at python.org> wrote:
> > > I'm not sure anyone has thought much about it yet. I wonder
> > > if the call shouldn't be made like this:
> > >
> > > __prepare__(name, bases, **kwargs)
> > >
> > > so that if you only expect certain specific keyword args you can
> > > define it like this:
> > >
> > > def __prepare__(name, base, metaclass=X): ...
> >
> >Yeah, seems like **kwargs would be more useful in practice.
>
> Really? Why? I can more easily see circumstances where you'd want to
> restrict the arguments. In the cases I have where I'd switch from a class
> decorator to a class keyword, I have a small set of decorators and would
> have an equally small set of keywords.
Maybe I'm misunderstanding but isn't this a reason that you'd *want*
the ``**kwargs`` signature? With the plain ``kwargs`` signature from
the PEP you'd have to do something like::
def __prepare__(name, args, kwargs):
required = kwargs.pop('required', None)
if required is not None:
...
STeVe
--
I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a
tiny blip on the distant coast of sanity.
--- Bucky Katt, Get Fuzzy
More information about the Python-3000
mailing list