Stefan Behnel added the comment:

Here's another idea. There could be two implementations of "slice", one that 
uses Python object indices (as currently) and one that has Py_ssize_t indices  
(and properties for the start/stop/step attributes). Similar to what Unicode 
strings do, the slice type would decide which to use at instantiation time.

The internals of PySliceObject are not part of the stable ABI, and the normal 
way to figure out the indices is PySlice_GetIndicesEx(), which would be adapted 
accordingly.

This breaks compatibility with some C extensions that access the slice 
attributes directly, but that should be rare, given how complex index 
calculations are.

This change is certainly more invasive than adding Py_ssize_t fields to the 
existing object, though.

----------
versions: +Python 3.5 -Python 3.4

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18813>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to