New submission from George King:

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.

----------
messages: 290737
nosy: gwk
priority: normal
severity: normal
status: open
title: list and tuple index methods should accept None parameters

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

Reply via email to