a quickie: range - x

Paul Rubin http
Thu Nov 30 05:11:24 CET 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