Is it possible to merge xrange and slice?
- From: Bas <wegwerp@xxxxxxxxx>
- Date: 30 Apr 2007 11:02:19 -0700
Hi,
stupid question, but would it be possible to somehow merge xrange
(which is supposed to replace range in py3k) and slice? Both have very
similar start, stop and step arguments and both are lightweight
objects to indicate a range. But you can't do a[xrange(10,20)] and
'for i in slice(10,20)'. The only difference is see is some behavior
with infinities (e.g. object[3:] gives a slice(3,maxint) inside
_getitem_ , but I think this should not be a large problem
(xrange(0,infinity) could just yield a generator that never stops).
Which problems am I overlooking that prevent this?
Cheers,
Bas
.
- Follow-Ups:
- Re: Is it possible to merge xrange and slice?
- From: BJörn Lindqvist
- Re: Is it possible to merge xrange and slice?
- From: Matimus
- Re: Is it possible to merge xrange and slice?
- Prev by Date: Re: regexp match string with word1 and not word2
- Next by Date: Re: Restricting the alphabet of a string
- Previous by thread: re-importing modules
- Next by thread: Re: Is it possible to merge xrange and slice?
- Index(es):
Relevant Pages
|