[Python-Dev] for loop with if filter (original) (raw)
Tristan Seligmann mithrandi-python-dev at mithrandi.za.net
Sat Nov 17 02:31:51 CET 2007
- Previous message: [Python-Dev] for loop with if filter
- Next message: [Python-Dev] Summary of Tracker Issues
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
- Terry Reedy <tjreedy at udel.edu> [2007-11-16 18:31:12 -0500]:
"Gustavo Carneiro" <gjcarneiro at gmail.com> wrote in message news:a467ca4f0711160617p11564c05q8b2c59e87981c028 at mail.gmail.com... |I am finding myself often doing for loops over a subset of a list, like: | | for r in results: | if r.numNodes != numNodes: | continue | # do something with r Why write it backwards? for r in results: if r.numNodes == numNodes # do something with r is the direct parallel with the below code.
The extra level of indentation is awkward.
mithrandi, i Ainil en-Balandor, a faer Ambar -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: Digital signature Url : http://mail.python.org/pipermail/python-dev/attachments/20071117/0cb16eef/attachment.pgp
- Previous message: [Python-Dev] for loop with if filter
- Next message: [Python-Dev] Summary of Tracker Issues
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]