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


Groups > comp.lang.python > #17547

Re: Grammar for classes

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.010
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'syntax.': 0.09; 'expression,': 0.16; 'subject:classes': 0.16; 'tried:': 0.16; 'cc:addr:python-list': 0.16; 'mon,': 0.16; 'received:74.125.82.44': 0.16; 'received:mail-ww0-f44.google.com': 0.16; 'syntax': 0.16; 'wrote:': 0.18; 'cc:no real name:2**0': 0.20; 'thorough': 0.21; 'dec': 0.22; "doesn't": 0.22; 'header:In- Reply-To:1': 0.22; 'statement': 0.23; 'thus': 0.23; 'clause': 0.23; 'pep': 0.23; 'defined': 0.24; 'cc:2**0': 0.24; 'suspect': 0.24; 'says': 0.25; 'function': 0.27; 'message- id:@mail.gmail.com': 0.28; 'cc:addr:python.org': 0.29; 'pm,': 0.29; 'class': 0.29; "i've": 0.31; 'does': 0.32; "won't": 0.33; 'received:74.125.82': 0.35; 'for?': 0.37; 'but': 0.37; 'received:74.125': 0.37; 'received:google.com': 0.37; "there's": 0.37; "it's": 0.40; '2011': 0.61; '19,': 0.68; 'soon.': 0.71; 'anytime': 0.74
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=tt7FfLaRUqfDjVlP3Jmqny1tCj+SpscInbOb6nJZn4A=; b=G9aneHTnMCAtxiSFOliLhX1CBtO0GZlYmj1KSqQf7eMYTYwu/+OK1EEN7lgLtRx141 4NbNObxpgjeF9F4ohE7OINrDweaaeA97u2JWLjG0DhdiDb/6dFFSVW77PdtPhv+ESx7G DtCDH9+w+vG33d+uatUiDxiQ8lLuBv675L9Yk=
MIME-Version 1.0
In-Reply-To <CAN1F8qWV1j-2VDvMyh47dxfj4G_yXSP8rcUdmpBY-HLrD5gaUQ@mail.gmail.com>
References <CAN1F8qWV1j-2VDvMyh47dxfj4G_yXSP8rcUdmpBY-HLrD5gaUQ@mail.gmail.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Mon, 19 Dec 2011 20:46:29 -0700
Subject Re: Grammar for classes
To Joshua Landau <joshua.landau.ws@gmail.com>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3846.1324352821.27778.python-list@python.org> (permalink)
Lines 20
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1324352821 news.xs4all.nl 6846 [2001:888:2000:d::a6]:41007
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:17547

Show key headers only | View raw


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.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web