[Python-ideas] range

Antoine Pitrou solipsis at pitrou.net
Fri Feb 22 19:43:10 CET 2013


On Fri, 22 Feb 2013 17:40:29 +0000 (UTC)
Wolfgang Maier
<wolfgang.maier at biologie.uni-freiburg.de>
wrote:
> Nick Coghlan <ncoghlan at ...> 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

Antoine.





More information about the Python-ideas mailing list