[issue34848] range.index only takes one argument when it's documented as taking the usual 3

2019-05-04 Thread STINNER Victor


STINNER Victor  added the comment:

I merged the pull requests. Thanks.

--
nosy: +vstinner
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34848] range.index only takes one argument when it's documented as taking the usual 3

2019-05-03 Thread miss-islington


Change by miss-islington :


--
pull_requests: +12989

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34848] range.index only takes one argument when it's documented as taking the usual 3

2018-10-14 Thread Roundup Robot


Change by Roundup Robot :


--
pull_requests: +9244

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34848] range.index only takes one argument when it's documented as taking the usual 3

2018-10-14 Thread Roundup Robot


Change by Roundup Robot :


--
pull_requests: +9243

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34848] range.index only takes one argument when it's documented as taking the usual 3

2018-10-14 Thread Srinivas Reddy T


Change by Srinivas  Reddy T :


--
keywords: +patch
pull_requests: +9240
stage: needs patch -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34848] range.index only takes one argument when it's documented as taking the usual 3

2018-10-06 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

One bug or feature request per issue please. If you want to change list.index() 
or operator.indexOf(), open new issues for this. This issue is for the error in 
the range.index() docstring.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34848] range.index only takes one argument when it's documented as taking the usual 3

2018-10-06 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34848] range.index only takes one argument when it's documented as taking the usual 3

2018-09-30 Thread Dan Snider


Dan Snider  added the comment:

So I also just happened to notice that the "documentation is wrong" for list, 
tuple, and collections.deque. They use use _PyEval_SliceIndexNotNone whch 
causes this:

>>> s = 'abcde'
>>> s.index('d', 0, None)
3
>>> [*s].index('d', None)
Traceback (most recent call last):
  File "", line 1, in 
[*s].index('d', None)
TypeError: slice indices must be integers or have an __index__ method

In 3.6.0, that error message is:
TypeError: slice indices must be integers or None or have an __index__ 
method

which means someone else was aware of this behavior and switched from 
_PyEval_SliceIndex to _PyEval_SliceIndexNotNone but didn't think these 
inconsistencies were inappropriate?

Anyway, I'll go ahead fix the docs later for accuracy's sake, but I'd much 
rather update operator.indexOf to use a new abstract api function: 
"PySequence_IndexOf" or some such, which is also capable of handling starting 
from the tail like str.rindex. 

If that's something that could be done, after I finish the Python prototype of 
this sequence ChainMap analog and rewrite it in C, I'll have made my own 
abstract sequence index function which I'd happily share.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34848] range.index only takes one argument when it's documented as taking the usual 3

2018-09-30 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Thank you for your report Dan. It is easy to fix a docstring.

Related issues are issue28197 and issue31942.

--
components:  -Argument Clinic
keywords: +easy (C)
nosy: +rhettinger, serhiy.storchaka -larry
stage:  -> needs patch
type:  -> behavior
versions: +Python 3.8 -Python 3.4, Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34848] range.index only takes one argument when it's documented as taking the usual 3

2018-09-29 Thread Dan Snider


New submission from Dan Snider :

Unfortunately, it looks like there's no requirement for an abc.Sequence to 
implement the 3 argument form of seq.index, so I suppose this is technically 
just a documentation bug...

>>> range(5).index(2, 1)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: index() takes exactly one argument (2 given)

>>> help(range.index)
Help on method_descriptor:

index(...)
rangeobject.index(value, [start, [stop]]) -> integer -- return index of 
value.
Raise ValueError if the value is not present.

--
assignee: docs@python
components: Argument Clinic, Documentation
messages: 326701
nosy: bup, docs@python, larry
priority: normal
severity: normal
status: open
title: range.index only takes one argument when it's documented as taking the 
usual 3
versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com