[Tutor] build list of non-empty variables

Kent Johnson kent37 at tds.net
Thu Jul 10 04:16:37 CEST 2008


On Wed, Jul 9, 2008 at 9:38 PM, John Fouhy <john at fouhy.net> wrote:
> On 10/07/2008, Kent Johnson <kent37 at tds.net> wrote:
>>  The actual formal syntax definitions for the two are slightly different:
>>  http://docs.python.org/ref/lists.html
>>  http://docs.python.org/ref/genexpr.html

> Is the generator expression grammar right?  How do I parse, e.g.,
> '(x+1 for x in range(10))'?  Seems like there's nothing there for
> 'range(10)'.  Like it should replace 'or_test' with 'old_expression'.

I can't figure out how to parse that either, as a gen exp or a list comp.

Kent


More information about the Tutor mailing list