On Oct 10, 2007, at 2:51 PM, brad wrote: > I was looking at a way to implement Ruby's upto method in python. I > came > up with the code below... three years ago, I would never have > thought of > list comprehension, today it seems second nature. This may be totally > un-Pythonic, but I thought it was kind of clever. Man, for some > reason, > I feel like being rude and lofty acting :) > > 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]
big_evens = range(10, 100, 2) > > low_evens = [2,4,6,8] > # make a list containing 11 - 99 odds only > big_odds = [x for x in list(xrange(100)) if x % 2 != 0 and x >9] big_odds = range(11, 100, 2) Erik Jones Software Developer | Emma® [EMAIL PROTECTED] 800.595.4401 or 615.292.5888 615.292.0777 (fax) Emma helps organizations everywhere communicate & market in style. Visit us online at http://www.myemma.com -- http://mail.python.org/mailman/listinfo/python-list