[issue13349] Non-informative error message in index() and remove() functions

2017-05-28 Thread Jim Fasarakis-Hilliard
Jim Fasarakis-Hilliard added the comment: Thanks, I understand why this isn't the best idea now. > shouldn't we change error messages that contains the repr of not found value? That is what I was thinking too, apart from removing the repr from other messages it will also unify reporting for

[issue13349] Non-informative error message in index() and remove() functions

2017-05-28 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I concur with Raymond. But shouldn't we change error messages that contains the repr of not found value? Affected collections are list, deque and range. >>> [].index('spam') Traceback (most recent call last): File "", line 1, in ValueError: 'spam' is not

[issue13349] Non-informative error message in index() and remove() functions

2017-05-27 Thread Nick Coghlan
Nick Coghlan added the comment: While I agree it's reasonable to keep arbitrary value repr's out of these messages by default, I do think it would be desirable for someone sufficiently motivated to file a separate RFE about adding the value as a structured exception attribute so that custom

[issue13349] Non-informative error message in index() and remove() functions

2017-05-27 Thread Raymond Hettinger
Raymond Hettinger added the comment: > I'm fine with not changing this Thanks Brett. I'm going to mark this as closed/rejected. After five years, it is time to put it to rest and let it stop consuming our mental clock cycles. > I don't think you're guaranteed to have access to the object >

[issue13349] Non-informative error message in index() and remove() functions

2017-05-27 Thread Brett Cannon
Brett Cannon added the comment: I'm fine with not changing this, but I did want to say that I don't think you're guaranteed to have access to the object that triggered the ValueError. If the value that is searched for is in some extension module where it's calculated using C code then you

[issue13349] Non-informative error message in index() and remove() functions

2017-05-27 Thread Joe Jevnik
Changes by Joe Jevnik : -- pull_requests: +1919 ___ Python tracker ___ ___

[issue13349] Non-informative error message in index() and remove() functions

2017-05-27 Thread Raymond Hettinger
Raymond Hettinger added the comment: Thinking back over my 17 years of using Python, I really don't think this is needed at all. I can't think of a single situation where it would have helped. In some cases, the change would be detrimental to readability, introducing clutter into an

[issue13349] Non-informative error message in index() and remove() functions

2017-05-26 Thread Brett Cannon
Brett Cannon added the comment: A potential compromise would be if ValueError gained a 'value' attribute. That would allow for the exception message to be static but still provide the information for introspection later if desired to figure out exactly what object led to the cause of the

[issue13349] Non-informative error message in index() and remove() functions

2017-05-26 Thread Brett Cannon
Changes by Brett Cannon : -- nosy: +brett.cannon ___ Python tracker ___ ___

[issue13349] Non-informative error message in index() and remove() functions

2017-05-26 Thread Raymond Hettinger
Raymond Hettinger added the comment: See http://bugs.python.org/issue30477 for why I think this shouldn't be done. In short, the IndexError may be part of control flow (looping over successive matches) rather than an error (this patch adds a time/space cost with no benefit in those cases).

[issue13349] Non-informative error message in index() and remove() functions

2017-04-26 Thread Zahari Dim
Changes by Zahari Dim : -- pull_requests: +1418 ___ Python tracker ___ ___

[issue13349] Non-informative error message in index() and remove() functions

2017-03-28 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Error messages should use repr(). For example str() of bytes object emits a warning or error. See issue26090 for the issue with truncated reprs. -- ___ Python tracker

[issue13349] Non-informative error message in index() and remove() functions

2017-03-28 Thread Jim Fasarakis-Hilliard
Jim Fasarakis-Hilliard added the comment: Could use `%.100S` instead of `%.100R` but I'm not sure of the downsides that might entail. -- ___ Python tracker

[issue13349] Non-informative error message in index() and remove() functions

2017-03-28 Thread Jim Fasarakis-Hilliard
Jim Fasarakis-Hilliard added the comment: Yes, that does look like too much. My rationale for adding quotes around the value was in order to make it more clear in cases where the repr exceeds 100 characters. Instead of: Traceback (most recent call last): File "", line 1, in

[issue13349] Non-informative error message in index() and remove() functions

2017-03-28 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: >>> [1, 2, 3].index("'") Traceback (most recent call last): File "", line 1, in ValueError: ""'"" not in list Aren't too much quotes? -- ___ Python tracker

[issue13349] Non-informative error message in index() and remove() functions

2017-03-28 Thread Jim Fasarakis-Hilliard
Changes by Jim Fasarakis-Hilliard : -- pull_requests: +775 ___ Python tracker ___ ___

[issue13349] Non-informative error message in index() and remove() functions

2017-03-25 Thread Jim Fasarakis-Hilliard
Jim Fasarakis-Hilliard added the comment: Additional instances of this: - function indexOf of operator.py. - function _PySequence_IterSearch of abstract.c -- ___ Python tracker

[issue13349] Non-informative error message in index() and remove() functions

2017-03-22 Thread Emmanuel Arias
Emmanuel Arias added the comment: I agree with Jim Fasarakis-Hilliard this message may be change in new 3.7 version -- nosy: +eamanu ___ Python tracker

[issue13349] Non-informative error message in index() and remove() functions

2017-03-19 Thread Jim Fasarakis-Hilliard
Jim Fasarakis-Hilliard added the comment: @Sean Ochoa, do you want to make this into a PR? The only tweak I would suggest would be to change all error messages to either be: "object.method(repr(x)): element not in object" or: "repr(x) not in object" also, this probably needs to be

[issue13349] Non-informative error message in index() and remove() functions

2013-05-06 Thread STINNER Victor
STINNER Victor added the comment: Confirmed with Ezio that issue #7330 will need to be fixed/approved before this issue can be closed. FYI I just fixed this issue. PyUnicode_FromFormat() now supports width and precision in the format string. -- nosy: +haypo

[issue13349] Non-informative error message in index() and remove() functions

2012-12-08 Thread Sean Ochoa
Sean Ochoa added the comment: Update based on Taggnostr's (Ezio on IRC, if I recall correctly) feedback from 11/12/2012 around 11:57 PST. * Added check for index result in positive tests. * Added assertIn check for remove result in positive tests. * Removed extra whitespace. * Formatted

[issue13349] Non-informative error message in index() and remove() functions

2012-12-08 Thread Sean Ochoa
Sean Ochoa added the comment: * Fixed issue with test name in Lib/test/test_tuple.py * Fixed issue with test_remove in Lib/test/test_list.py to assertNotIn instead of assertIn for positive case. Confirmed with Ezio that issue #7330 will need to be fixed/approved before this issue can be

[issue13349] Non-informative error message in index() and remove() functions

2012-11-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: See also my comments to previous patch about repr() and error message checking. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13349 ___

[issue13349] Non-informative error message in index() and remove() functions

2012-11-12 Thread Sean Ochoa
Sean Ochoa added the comment: Lib/test/test_array.py -- Moved index test (for this issue) to test_index (existing test method). -- Added remove test (for this issue) to test_remove (existing test method) Lib/test/test_deque.py -- Moved remove test (for this issue) to test_index (existing

[issue13349] Non-informative error message in index() and remove() functions

2012-11-10 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- dependencies: +PyUnicode_FromFormat: implement width and precision for %s, %S, %R, %V, %U, %A ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13349

[issue13349] Non-informative error message in index() and remove() functions

2012-11-10 Thread Sean Ochoa
Sean Ochoa added the comment: Updates after feedback from Serhiy. -- Added file: http://bugs.python.org/file27949/issue13349.patch.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13349 ___

[issue13349] Non-informative error message in index() and remove() functions

2012-11-10 Thread Julian Berman
Julian Berman added the comment: test_issuewhatever is a bit indescriptive. It'd be easier for someone glancing at the test to see what it claims to be testing if there were a more descriptive name given, like perhaps test_exception_message (or something even more verbose). -- nosy:

[issue13349] Non-informative error message in index() and remove() functions

2012-11-10 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Or test_index()/test_remove(). In this case positive test cases (and may be other exception types) should be added. -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org

[issue13349] Non-informative error message in index() and remove() functions

2012-11-09 Thread Sean Ochoa
Sean Ochoa added the comment: Truncating repr strings to 100chars will require the patch from #7330. After applying the patch from that issue, my tests work fine. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13349

[issue13349] Non-informative error message in index() and remove() functions

2012-11-09 Thread Sean Ochoa
Sean Ochoa added the comment: Updated patch after taking into account Ezio's (aka Taggnostr on #python-dev) latest feedback. -- Added file: http://bugs.python.org/file27940/issue13349.patch.2 ___ Python tracker rep...@bugs.python.org

[issue13349] Non-informative error message in index() and remove() functions

2012-11-07 Thread Sean Ochoa
Sean Ochoa added the comment: From Taggnostr on #python-dev: 1.) Use assertRaises+assertIn instead of assertRaisesRegex 2.) Add or change an existing test that you've already updated to use elements with a repr longer than 100 chars. -- ___

[issue13349] Non-informative error message in index() and remove() functions

2012-11-05 Thread Sean Ochoa
Sean Ochoa added the comment: Tests updated for coverage and to use assertRaisesRegex. -- Added file: http://bugs.python.org/file27907/issue13349.patch.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13349

[issue13349] Non-informative error message in index() and remove() functions

2012-11-04 Thread Sean Ochoa
Sean Ochoa added the comment: After discussing with folks on the #python-dev tonight, I learned that I was testing with a list and I should've been using a set. I'm working on a patch now, and I'm almost ready to have it reviewed. -- ___ Python

[issue13349] Non-informative error message in index() and remove() functions

2012-11-04 Thread Sean Ochoa
Sean Ochoa added the comment: Ready for review. -- keywords: +patch Added file: http://bugs.python.org/file27884/issue-13349.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13349 ___

[issue13349] Non-informative error message in index() and remove() functions

2012-11-04 Thread Ezio Melotti
Ezio Melotti added the comment: You should use assertRaises/assertRaisesRegex to check the error message and add more tests to cover all the changes. I also noticed an inconsistence between 'element not in container' and 'element is not in container' (note the extra 'is'). FWIW I prefer the

[issue13349] Non-informative error message in index() and remove() functions

2012-11-03 Thread Éric Araujo
Changes by Éric Araujo mer...@netwok.org: -- title: Uninformal error message in index() and remove() functions - Non-informative error message in index() and remove() functions ___ Python tracker rep...@bugs.python.org

[issue13349] Non-informative error message in index() and remove() functions

2012-11-03 Thread Sean Ochoa
Sean Ochoa added the comment: Working on issue as part of Python Bug Day, Oct 2012. -- nosy: +Sean.Ochoa ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13349 ___

[issue13349] Non-informative error message in index() and remove() functions

2012-11-03 Thread Sean Ochoa
Sean Ochoa added the comment: It seems that this has been fixed. Using simple tests from msg147215: ~/hg/cpython/working $ env-py3.3/bin/python Python 3.3.0 (default, Nov 3 2012, 15:28:29) [GCC 4.7.2] on linux Type help, copyright, credits or license for more information.

[issue13349] Non-informative error message in index() and remove() functions

2012-11-03 Thread Terry J. Reedy
Terry J. Reedy added the comment: The original example was about tuples and displaying 'x' instead of '4'. Have that and *all* the others been fixed? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13349