[issue13340] list.index does not accept None as start or stop

2020-09-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Thank you for the reminder Irit. Your comments for issues and PRs are really helpful. Thank you for all this! -- nosy: +serhiy.storchaka resolution: -> out of date stage: needs patch -> resolved status: open -> closed _

[issue13340] list.index does not accept None as start or stop

2020-09-15 Thread Irit Katriel
Irit Katriel added the comment: The error message was fixed under issue29935, so I think this issue can now be closed. -- nosy: +iritkatriel ___ Python tracker ___ __

[issue13340] list.index does not accept None as start or stop

2016-04-16 Thread Berker Peksag
Berker Peksag added the comment: See http://thread.gmane.org/gmane.comp.python.devel/127502 for the python-dev thread. -- nosy: +berker.peksag versions: +Python 3.6 -Python 3.4 ___ Python tracker _

[issue13340] list.index does not accept None as start or stop

2014-10-09 Thread R. David Murray
R. David Murray added the comment: Per discussion in the issue, I'm changing this to a bugfix on the message text. If the python-dev discussion resulted (or results in the future) in a desire to change the API, that should be a new issue. -- nosy: +r.david.murray stage: commit review

[issue13340] list.index does not accept None as start or stop

2013-07-12 Thread Aaron Meurer
Changes by Aaron Meurer : -- nosy: +Aaron.Meurer ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.py

[issue13340] list.index does not accept None as start or stop

2012-02-25 Thread Éric Araujo
Changes by Éric Araujo : -- priority: high -> normal stage: committed/rejected -> commit review versions: -Python 2.7, Python 3.2 ___ Python tracker ___

[issue13340] list.index does not accept None as start or stop

2011-11-06 Thread Petri Lehtinen
Petri Lehtinen added the comment: It's now reverted on all branches. I posted to python-dev alreay earlier. -- ___ Python tracker ___ ___

[issue13340] list.index does not accept None as start or stop

2011-11-06 Thread Roundup Robot
Roundup Robot added the comment: New changeset 19ffa12ffdd4 by Petri Lehtinen in branch '2.7': Revert "Accept None as start and stop parameters for list.index() and tuple.index()" http://hg.python.org/cpython/rev/19ffa12ffdd4 New changeset ed0e85efac47 by Petri Lehtinen in branch '3.2': Revert

[issue13340] list.index does not accept None as start or stop

2011-11-06 Thread Raymond Hettinger
Raymond Hettinger added the comment: One other thought: the API for list.index() doesn't exist in isolation. There is also str.index, the sequence abstract base class, and tons of code that has been written to emulate lists. This is an ancient API (approx 20 years) and should only be chang

[issue13340] list.index does not accept None as start or stop

2011-11-06 Thread Raymond Hettinger
Raymond Hettinger added the comment: > There's still the question whether {list,tuple}.index() should accept None or > not. The API should not be changed for Py2.7 and Py3.2. Those changesets should be reverted. For Py3.3, it is open to discussion, but we probably don't need the change (ma

[issue13340] list.index does not accept None as start or stop

2011-11-06 Thread Petri Lehtinen
Petri Lehtinen added the comment: > Or am I misunderstanding? Ah, no, sorry. I wasn't aware of this. Now the error message set by _PyEval_SliceIndex() makes sense. It doesn't itself accept None, but apply_slice() and assign_slice() handle the None case. There's still the question whether {li

[issue13340] list.index does not accept None as start or stop

2011-11-06 Thread Mark Dickinson
Mark Dickinson added the comment: > What do you suggest? Doing it in _PyEval_SliceIndex() in 2.7 is > problematic, as we don't want x[None:2], right? :) Eh? Don't we already have this? Python 2.7.2 (default, Aug 22 2011, 13:53:27) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "he

[issue13340] list.index does not accept None as start or stop

2011-11-05 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: str.index does accept None, though -- nosy: +amaury.forgeotdarc ___ Python tracker ___ ___ Py

[issue13340] list.index does not accept None as start or stop

2011-11-05 Thread Raymond Hettinger
Raymond Hettinger added the comment: The API in 2.7 shouldn't be changed. The error message can be fixed though. Also, it is not clear that the API should change even in 3.3. The list.index() method is not required to accept None. It is not different than other APIs that use PyArg_ParseTupl

[issue13340] list.index does not accept None as start or stop

2011-11-05 Thread Petri Lehtinen
Petri Lehtinen added the comment: > 2) It probably should have been done in _PyEval_SliceIndex(). I saw that other code used the same approach as I used in the fix. The comment above _PyEval_SliceIndex() suggests it's used in other contexts too. It seems that 2.7 uses it to implement the SLICE

[issue13340] list.index does not accept None as start or stop

2011-11-05 Thread Raymond Hettinger
Raymond Hettinger added the comment: I think this "fix" was too hastily committed. 1) It was an API change. 2) It probably should have been done in _PyEval_SliceIndex(). Be careful. Don't rush to commit. Especially for backports. -- status: closed -> open _

[issue13340] list.index does not accept None as start or stop

2011-11-05 Thread Raymond Hettinger
Raymond Hettinger added the comment: The relevant code is in _PyEval_SliceIndex() in Python/ceval.c. -- nosy: +rhettinger ___ Python tracker ___

[issue13340] list.index does not accept None as start or stop

2011-11-05 Thread Petri Lehtinen
Petri Lehtinen added the comment: Committed a fix for both list and tuple. I considered this a bug fix rather than a new feature based on discussion in #11828, especially msg133532, and applied the fix to 2.7 and 3.2, too. -- ___ Python tracker

[issue13340] list.index does not accept None as start or stop

2011-11-05 Thread Roundup Robot
Roundup Robot added the comment: New changeset 0f0eda4daac7 by Petri Lehtinen in branch '2.7': Accept None as start and stop parameters for list.index() and tuple.index() http://hg.python.org/cpython/rev/0f0eda4daac7 New changeset 5c1fcaf3cf1c by Petri Lehtinen in branch '3.2': Accept None as s

[issue13340] list.index does not accept None as start or stop

2011-11-05 Thread Alex Gaynor
Changes by Alex Gaynor : -- nosy: +alex ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/

[issue13340] list.index does not accept None as start or stop

2011-11-05 Thread Petri Lehtinen
Petri Lehtinen added the comment: The same issue exists for tuples: >>> (1, 2, 3).index(2, None) Traceback (most recent call last): File "", line 1, in TypeError: slice indices must be integers or None or have an __index__ method -- components: +Interpreter Core nosy: +petri.lehtine

[issue13340] list.index does not accept None as start or stop

2011-11-04 Thread Carl Friedrich Bolz
New submission from Carl Friedrich Bolz : The list.index method does not accept None as start and stop, which makes the error message quite confusing: >>> [1, 2, 3].index(2, None, None) Traceback (most recent call last): File "", line 1, in TypeError: slice indices must be integers or None o