Benjamin Peterson benja...@python.org added the comment:
This has already been implemented.
--
nosy: +benjamin.peterson
resolution: - out of date
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4510
Tim Lesher tles...@gmail.com added the comment:
Ugh. That's a reasonable objection.
What's the best thing to do in this case, generally speaking?
list.index() does print the full repr on a value error; and a quick grep shows
a number of other similar uses, although those don't seem to be as
Raymond Hettinger rhettin...@users.sourceforge.net added the comment:
Amaury, I agree about having a limit. It is a really bad idea to dump the full
list repr for a potentially huge list or even for a small list of objects with
huge individual reprs. We should limit the output to just a few
Tim Lesher tles...@gmail.com added the comment:
It looks as if this has been addressed for list.index (aka issue #7252), in
r76058. The same fix could be applied for list.remove.
--
___
Python tracker rep...@bugs.python.org
Tim Lesher tles...@gmail.com added the comment:
This patch combines the fix from Georg Brandl's original patch with the fix
made to listindex. The r76058 fix fails the test in Georg's original test
where the repr of the item to be removed itself raises; this patch handles that
case for both
Amaury Forgeot d'Arc amaur...@gmail.com added the comment:
The patch is good, except for two things:
when PyObject_Repr() fails, the word 'item' is put instead. This is a good
idea, but PyErr_Clear() should be called as soon as possible, before calling
another API function.
Also, the error
Changes by Tim Lesher tles...@gmail.com:
--
nosy: +tlesher
nosy_count: 2.0 - 3.0
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4510
___
___
Georg Brandl [EMAIL PROTECTED] added the comment:
Suggested patch attached, handles remove() and index().
--
keywords: +patch
nosy: +georg.brandl
stage: needs patch - patch review
Added file: http://bugs.python.org/file12244/list-excs.diff
___
Python
New submission from Brett Cannon [EMAIL PROTECTED]:
If you try to remove something from a list, e.g. ``[].remove(1)``, the
message from ValueError is rather useless: ValueError: list.remove(x):
x not in list. It should probably list the repr for the argument to
help in debugging.
--