a quickie: range - x

Paul Rubin http
Wed Nov 29 23:11:24 EST 2006


"rjtucke" <rjtucke at gmail.com> 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))



More information about the Python-list mailing list