Re: Is it possible to merge xrange and slice?
- From: "BJörn Lindqvist" <bjourne@xxxxxxxxx>
- Date: Mon, 30 Apr 2007 21:00:15 +0000
On 30 Apr 2007 11:02:19 -0700, Bas <wegwerp@xxxxxxxxx> wrote:
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?
Novel idea but how would slice(3,-1) work?
--
mvh Björn
.
- References:
- Prev by Date: Re: Python-URL! - weekly Python news and links (Apr 30)
- Next by Date: removing module
- Previous by thread: Re: Is it possible to merge xrange and slice?
- Next by thread: removing module
- Index(es):