Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #17547 > unrolled thread

Re: Grammar for classes

Started byIan Kelly <ian.g.kelly@gmail.com>
First post2011-12-19 20:46 -0700
Last post2011-12-19 20:46 -0700
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Grammar for classes Ian Kelly <ian.g.kelly@gmail.com> - 2011-12-19 20:46 -0700

#17547 — Re: Grammar for classes

FromIan Kelly <ian.g.kelly@gmail.com>
Date2011-12-19 20:46 -0700
SubjectRe: Grammar for classes
Message-ID<mailman.3846.1324352821.27778.python-list@python.org>
On Mon, Dec 19, 2011 at 6:34 PM, Joshua Landau
<joshua.landau.ws@gmail.com> wrote:
> In reading thorough the syntax defined in the reference, the class statement
> has surprised me.
>
> It says that the inheritance part of the class can accept comprehensions.
> What does this mean?
> I've tried:
> "class A(x for x in ()): pass"
> but this doesn't need the extra clause as "x for x in ()" is an expression,
> and thus this evaluates:
> "class A(x for x in (),): pass"
> although again it won't be a valid class anytime soon.
>
> So what is this clause for?

That's new to me as well.  There's nothing about it in PEP 3115.  I
suspect it's a bad copy-and-paste from the function call syntax.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web