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: 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: References: From: Ian Kelly Date: Mon, 19 Dec 2011 20:46:29 -0700 Subject: Re: Grammar for classes To: Joshua Landau 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 On Mon, Dec 19, 2011 at 6:34 PM, Joshua Landau wrote: > In reading thorough the syntax defined in the reference, the class statem= ent > has=A0surprised=A0me. > > 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 expressio= n, > 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.