loops -> list/generator comprehensions
Steven Bethard
steven.bethard at gmail.com
Sun Feb 6 17:44:21 EST 2005
More information about the Python-list mailing list
Sun Feb 6 17:44:21 EST 2005
- Previous message (by thread): loops -> list/generator comprehensions
- Next message (by thread): loops -> list/generator comprehensions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Alex Martelli wrote: > Steven Bethard <steven.bethard at gmail.com> wrote: > > >>at the OP's original code, the line: >> >> [(x[0], x[2]) for x in os.walk(".")] >> >>is the equivalent of: >> >> [dirpath, filenames for dirpath, dirnames, filenames in os.walk('.')] > > > Just a nit: you need parentheses in your second LC too, i.e.: > > [(dirpath, filenames) for dirpath, dirnames, filenames in os.walk('.')] Yup, you're right (of course) ;) Thanks for the catch! Steve
- Previous message (by thread): loops -> list/generator comprehensions
- Next message (by thread): loops -> list/generator comprehensions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list