[issue13349] Uninformal error message in index() and remove() functions

2011-11-18 Thread Petri Lehtinen
Petri Lehtinen added the comment: Nick Coghlan wrote: > Please don't stress too much about providing an indication that the > repr has been truncated - it's an error message, not part of the > normal program output. Besides, the lack of a closing ')', ']', '}' > or '>' will usually indicate some

[issue13349] Uninformal error message in index() and remove() functions

2011-11-18 Thread Nick Coghlan
Nick Coghlan added the comment: Please don't stress too much about providing an indication that the repr has been truncated - it's an error message, not part of the normal program output. Besides, the lack of a closing ')', ']', '}' or '>' will usually indicate something is amiss in long repr

[issue13349] Uninformal error message in index() and remove() functions

2011-11-18 Thread Petri Lehtinen
Petri Lehtinen added the comment: Ezio Melotti wrote: > You could start by adding it in the file where you need it. If it > starts becoming useful elsewhere too, it can then be moved somewhere > else. I would expect such function to be private, so we are free to > move it whenever we need it. W

[issue13349] Uninformal error message in index() and remove() functions

2011-11-18 Thread Ezio Melotti
Ezio Melotti added the comment: > I found safe_repr() from Lib/unittest/util.py. The functions in Lib/unittest/util.py shouldn't be used outside unittest. > We would require a similar function, just implemented in C. > What is a good place to define such C helpers that could be used everywhere

[issue13349] Uninformal error message in index() and remove() functions

2011-11-17 Thread Petri Lehtinen
Petri Lehtinen added the comment: I found safe_repr() from Lib/unittest/util.py. We would require a similar function, just implemented in C. What is a good place to define such C helpers that could be used everywhere? -- ___ Python tracker

[issue13349] Uninformal error message in index() and remove() functions

2011-11-17 Thread Terry J. Reedy
Terry J. Reedy added the comment: The test suite has code (functions) that restrict the length on AssertEqual (and other) failure messages. (I do not know the location though.) Perhaps that can be reused. This almost seems like something that should be more easily available. --

[issue13349] Uninformal error message in index() and remove() functions

2011-11-17 Thread Petri Lehtinen
Petri Lehtinen added the comment: Éric Araujo wrote: > > On the other hand, the repr of a value might be very long: > You can restrict the length with % formats. Seems you can't with %R. I'd also like to somehow indicate that the output is truncated. -- ___

[issue13349] Uninformal error message in index() and remove() functions

2011-11-12 Thread Terry J. Reedy
Terry J. Reedy added the comment: Improving error messages has been a long, slow process as people are irritated enough to make a change. Please go ahead. Guido has explicitly excluded exception detail from the language spec multiple times. Test that depend on details are broken. Doc examples

[issue13349] Uninformal error message in index() and remove() functions

2011-11-11 Thread Nick Coghlan
Nick Coghlan added the comment: doctests by their very nature tend to overspecify things - that's why actual regression tests should be written with unittest, while doctest is kept for its originally intended purpose of testing examples included in docstrings and other documentation. Still,

[issue13349] Uninformal error message in index() and remove() functions

2011-11-07 Thread Éric Araujo
Éric Araujo added the comment: > There's also documentation and tests that depend on this actual error message: > Doc/library/doctest.rst: ValueError: list.remove(x): x not in list > Lib/test>/test_xml_etree.py:ValueError: list.remove(x): x not in list That’s a well-known doctest problem.

[issue13349] Uninformal error message in index() and remove() functions

2011-11-07 Thread Éric Araujo
Éric Araujo added the comment: > The good thing about this is ease of debugging. Exactly! +1 for the idea. > On the other hand, the repr of a value might be very long: You can restrict the length with % formats. > Also, all values don't have a very informal repr: Not your problem. This chang

[issue13349] Uninformal error message in index() and remove() functions

2011-11-07 Thread Petri Lehtinen
Petri Lehtinen added the comment: The good thing about this is ease of debugging. You can see which is the offending value that was not found. On the other hand, the repr of a value might be very long: >>> [].index(list(range(1000))) ValueError: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ... (man

[issue13349] Uninformal error message in index() and remove() functions

2011-11-06 Thread Ezio Melotti
Changes by Ezio Melotti : -- nosy: +ezio.melotti stage: -> needs patch ___ Python tracker ___ ___ Python-bugs-list mailing list Unsub

[issue13349] Uninformal error message in index() and remove() functions

2011-11-05 Thread Petri Lehtinen
Changes by Petri Lehtinen : -- components: +Extension Modules, Interpreter Core type: -> behavior versions: +Python 3.3 ___ Python tracker ___ __

[issue13349] Uninformal error message in index() and remove() functions

2011-11-05 Thread Petri Lehtinen
New submission from Petri Lehtinen : For example: >>> (1, 2, 3).index(4) Traceback (most recent call last): File "", line 1, in ValueError: tuple.index(x): x not in tuple The "x not in tuple" error message should be replaced with "4 is not in tuple". list.index() already does this (see #725