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
Thanks, all- that helped.
Ross
--
http://mail.python.org/mailman/listinfo/python-list
"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
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
(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
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