On Aug 14, 2006, at 10:34 PM, Nick Coghlan wrote:

> Alexander Belopolsky wrote:
[snip]
>> Would it make sense to unify rangeobject with PySliceObject?
>
> Not really. The memory layouts may end up being the same in Py3k,  
> but they're still different types. The major differences between  
> the two types just happen to lie in the methods they support (as  
> defined by the value of the type pointer in PyObject_HEAD), rather  
> than the data they contain.

The slice objects support a single method "indices", which I have to  
admit I've have not seen before a minute ago.  (I've grepped through  
the standard library and did not see it used anywhere).   The slice  
attributes start/stop/step are probably more useful, but I don't see  
why those cannot be added to the range object.

>
> Besides, the range object may actually keep the current optimised  
> behaviour for dealing with PyInt values, only falling back to  
> PyObject* if one of start, stop or step was too large to fit into a  
> PyInt.


How would that hurt reusing them for slicing?
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to