[Python-3000] PEP for Metaclasses in Python 3000

Guido van Rossum guido at python.org
Tue Mar 13 02:48:06 CET 2007


On 3/12/07, Collin Winter <collinw at gmail.com> wrote:
> On 3/12/07, Guido van Rossum <guido at python.org> wrote:
> [snip stuff I agree with]
> > On 3/9/07, Brett Cannon <brett at python.org> wrote:
> > > Do the keywords have to follow the metaclass keyword, or is order
> > > irrelevant?  While order makes sense, it would be a new precedent for
> > > keyword arguments to have an important order.
> >
> > I'd like the syntax between () to be identical to that for a function
> > call, i.e. including *args and **kwds. That way the cognitive load for
> > the user is the smallest. Sorting out the semantics of the keywords is
> > purely a runtime activity anywaty.
>
> Woohoo! I've wanted to be able to say "class X(*args):" before, so
> this is great news.
>
> On a 2to3-related topic, will a __metaclass__ class attribute do the
> same thing as a metaclass keyword argument, or will a fixer be needed
> for this?

I'd like a fixer. The fixer could assume the __metaclass__ ass't is
first in the class, possibly after a docstring; I'm guessing this
would capture 99% of actual use cases and I'm sure people who put it
somewhere else can move it forward so they'll have code that converts
cleanly.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list