PEP 289: Generator Expressions (please comment)

Bjorn Pettersen bjorn.pettersen at comcast.net
Thu Oct 23 21:26:36 EDT 2003


Christoph Becker-Freyseng <webmaster at beyond-thoughts.com> wrote in 
news:mailman.59.1066957147.702.python-list at python.org:

[...]
> 
> 
> BTW: Python is getting more and more stuff. So I fear that some code 
> might get harder to read for newbies (not knowing all the new stuff).
> 
> Would it be possible to make an expression-/statement-parser that can 
> analyse a code snippet (one line of python-code maybe more) and tell the 
> user what syntax-constructs were used.
> 
> This might be a big help when reading code and if you don't know some 
> special construct.
> 
> e.g.:
>     newstuff.py:
>        ...
>        sum(x*x for x in roots)
>        ...
>     ??? Mmmm What's that
>     pyscryer "sum(x*x for x in roots)"
>        <Function-Call>(<Generator Expression>)
> 
> Then you can search the Internet to close your knowledge gap (you can't 
> search for "sum(x*x for x in roots)", but "python Generator Expression" 
> might be succesful)

Something like:

  compiler.parse("[x*x for x in roots]")

(not completely what you want, but close :-)

-- bjorn




More information about the Python-list mailing list