convert loop to list comprehension

Felipe Almeida Lessa felipe.lessa at gmail.com
Fri Sep 8 20:52:14 EDT 2006


8 Sep 2006 17:37:02 -0700, bvdp at xplornet.com <bvdp at xplornet.com>:
> 1. Using an _ is an interesting way to use a throw-away variable. Never
> would I think of that ... but, then, I don't do Perl either :)

It's a kind of convention. For example, Pylint complains for all
variables you set and don't use unless its name is "_".

> 2. Any reason for xrange() instead of range()

It's faster.

-- 
Felipe.



More information about the Python-list mailing list