I'm starting to think like a Pythonista
Marc 'BlackJack' Rintsch
bj_666 at gmx.net
Wed Oct 10 17:16:50 EDT 2007
On Wed, 10 Oct 2007 17:03:41 -0400, brad wrote:
> Bjoern Schliessmann wrote:
>> brad wrote:
>>> low_odds = [1,3,5,7,9]
>>> # make a list containing 10 - 98 evens only
>>> big_evens = big_evens = [x for x in list(xrange(99)) if x % 2 ==
>>> 0 and x >8]
>>
>> Why use xrange if you convert it to a full list in place? No
>> advantage there.
>
> What is the dis-advantage of using xrange over range in this circumstance?
It's an unnecessary intermediate step.
Ciao,
Marc 'BlackJack' Rintsch
More information about the Python-list
mailing list