Re: a quickie: range - x

2006-11-30 Thread Kent Johnson
Steven D'Aprano wrote: > On Wed, 29 Nov 2006 19:42:16 -0800, rjtucke wrote: > >> I want an iterable from 0 to N except for element m (<=M). > x = range(m-1) + range(m+1, N) Should be range(m) + range(m+1, N) Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: a quickie: range - x

2006-11-29 Thread rjtucke
Thanks, all- that helped. Ross -- http://mail.python.org/mailman/listinfo/python-list

Re: a quickie: range - x

2006-11-29 Thread Paul Rubin
"rjtucke" <[EMAIL PROTECTED]> writes: > I want an iterable from 0 to N except for element m (<=M). > I could write > x = range(N) > x.remove(m) > but I want it in one expression. itertools.chain(xrange(0,m), xrange(m+1, N)) -- http://mail.python.org/mailman/listinfo/python-list

Re: a quickie: range - x

2006-11-29 Thread Steven D'Aprano
On Wed, 29 Nov 2006 19:42:16 -0800, rjtucke wrote: > I want an iterable from 0 to N except for element m (<=M). > I could write > x = range(N) > x.remove(m) > but I want it in one expression. Because the world will end if you can't? What's wrong with the solution you already have? If you need to

Re: a quickie: range - x

2006-11-29 Thread johnzenger
(x for x in xrange(N+1) if x != m) rjtucke wrote: > I want an iterable from 0 to N except for element m (<=M). > I could write > x = range(N) > x.remove(m) > but I want it in one expression. > > Thanks, > Ross -- http://mail.python.org/mailman/listinfo/python-list

a quickie: range - x

2006-11-29 Thread rjtucke
I want an iterable from 0 to N except for element m (<=M). I could write x = range(N) x.remove(m) but I want it in one expression. Thanks, Ross -- http://mail.python.org/mailman/listinfo/python-list