bpo-13349: repr object in tuple.index ValueError message#1820
bpo-13349: repr object in tuple.index ValueError message#1820llllllllll wants to merge 1 commit intopython:masterfrom
Conversation
|
@llllllllll, thanks for your PR! By analyzing the history of the files in this pull request, we identified @serhiy-storchaka, @rhettinger and @tiran to be potential reviewers. |
Objects/tupleobject.c
Outdated
There was a problem hiding this comment.
Please don't do assignment in an if guard as it's hard to notice it's not a comparison.
|
Could you open an issue for this, @llllllllll ? I actually want to discuss the message a bit more. |
a6e09fb to
453213f
Compare
|
It looks like we just changed the title at the same time, should it include the issue number? |
|
@llllllllll yep, race condition. 😬 |
453213f to
23a63ad
Compare
|
I made another PR a couple of months back that address the error message both for |
|
I've renumbered this to the superseding issue so we know we have two implementations for a similar idea (assuming the idea even gets approved). |
|
bpo-13349 was closed. The idea was rejected. |
The old error of
tuple.index(x): x not in tupleseemed very confusing to me. It was also harder to quickly understand what the program was doing wrong. This saves people a second pass through the program under the debugger because they can just see what the invalid value was.The reason I am explicitly calling repr instead of using
%Ris that I didn't want to call repr twice if I didn't need to. If people think that is fine the format can just betuple.index(%R): %R not in tupleinstead.