
On Fri, Feb 22, 2013 at 1:43 PM, Antoine Pitrou <solipsis@pitrou.net> wrote:
On Fri, 22 Feb 2013 17:40:29 +0000 (UTC) Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> wrote:
Nick Coghlan <ncoghlan@...> writes:
-1 from me as well. We don't even implement concatenation and repetition for ranges in order to keep them simple - we have to caveat the range docs to point out they don't *quite* implement the full sequence API due to this restriction.
However, I will note that starting in Python 3.3, range objects expose their "start", "stop" and "step" attributes. That makes it much easier for third party software to manipulate them arithmetically.
Cheers, Nick.
Any plans to make range a valid base class to build upon in future releases?
I suppose it wouldn't very difficult to make range subclassable. You can try writing a patch if you want: http://docs.python.org/devguide/
Regards
I would be very happy to see a similar data structure available (on pypi). I was writing an HTTP-backed file object that used partial GET requests to just fetch the parts of the file that were actually read; it would have benefited from an efficient set-of-ranges (start+stop but not step) implementation.