Message290737
As of python3.6, passing None to the start/end parameters of `list.index` and `tuple.index` raises the following exception:
"slice indices must be integers or None or have an __index__ method"
This suggests that the intent is to support None as a valid input. This would be quite useful for the end parameter, where the sensible default is len(self) rather than a constant. Note also that str, bytes, and bytearray all support None.
I suggest that CPython be patched to support None for start/end. Otherwise, at the very least the exception message should be changed.
Accepting None will make the optional start/end parameters for this method more consistent across the types, which is especially helpful when using type annotations / checking. |
|
Date |
User |
Action |
Args |
2017-03-28 16:16:22 | gwk | set | recipients:
+ gwk |
2017-03-28 16:16:21 | gwk | set | messageid: <1490717781.97.0.695968126549.issue29935@psf.upfronthosting.co.za> |
2017-03-28 16:16:21 | gwk | link | issue29935 messages |
2017-03-28 16:16:21 | gwk | create | |
|