Grammar for classes

Ian Kelly ian.g.kelly at gmail.com
Thu Dec 22 20:27:54 EST 2011


On Thu, Dec 22, 2011 at 4:39 PM, Terry Reedy <tjreedy at udel.edu> wrote:
> Beats me. The 2.7 doc says inheritance ::=  "(" [expression_list] ")" and I
> no on no 3.x change/addition.

Well, there is one change in 3.x which is that the inheritance list
now accepts keyword parameters (PEP 3115) -- the "metaclass" keyword
specifies the metaclass instead of using a bogus __metaclass__
attribute, and any other keywords are passed along to the metaclass.
That's why the parsing of the inheritance list was generalized to look
more like a function call, but it doesn't explain why the class
declaration might wish to receive a comprehension.

Cheers,
Ian



More information about the Python-list mailing list