Author gwk
Recipients gwk
Date 2017-03-28.16:16:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1490717781.97.0.695968126549.issue29935@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2017-03-28 16:16:22gwksetrecipients: + gwk
2017-03-28 16:16:21gwksetmessageid: <1490717781.97.0.695968126549.issue29935@psf.upfronthosting.co.za>
2017-03-28 16:16:21gwklinkissue29935 messages
2017-03-28 16:16:21gwkcreate