A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2007-November/075266.html below:

[Python-Dev] for loop with if filter

[Python-Dev] for loop with if filter [Python-Dev] for loop with if filterTristan Seligmann mithrandi-python-dev at mithrandi.za.net
Sat Nov 17 02:31:51 CET 2007
* 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 
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4