Skip to content

Conversation

@llllllllll
Copy link
Contributor

The old error of tuple.index(x): x not in tuple seemed 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 %R is 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 be tuple.index(%R): %R not in tuple instead.

@mention-bot
Copy link

@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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't do assignment in an if guard as it's hard to notice it's not a comparison.

@brettcannon
Copy link
Member

Could you open an issue for this, @llllllllll ? I actually want to discuss the message a bit more.

@llllllllll llllllllll force-pushed the tuple-index-error branch from a6e09fb to 453213f Compare May 25, 2017 22:42
@llllllllll llllllllll changed the title [trivial] Repr object in tuple.index IndexError message bpo-30477 Repr object in tuple.index IndexError message May 25, 2017
@brettcannon brettcannon changed the title bpo-30477 Repr object in tuple.index IndexError message Repr object in tuple.index IndexError message May 25, 2017
@llllllllll
Copy link
Contributor Author

It looks like we just changed the title at the same time, should it include the issue number?

@brettcannon brettcannon changed the title Repr object in tuple.index IndexError message bpo-30477: repr object in tuple.index IndexError message May 25, 2017
@brettcannon
Copy link
Member

@llllllllll yep, race condition. 😬

@llllllllll llllllllll changed the title bpo-30477: repr object in tuple.index IndexError message bpo-30477: repr object in tuple.index ValueError message May 25, 2017
@llllllllll llllllllll force-pushed the tuple-index-error branch from 453213f to 23a63ad Compare May 25, 2017 22:53
@DimitrisJim
Copy link
Contributor

DimitrisJim commented May 26, 2017

I made another PR a couple of months back that address the error message both for tuple.index and in other cases it manifests: #876.

@brettcannon brettcannon changed the title bpo-30477: repr object in tuple.index ValueError message bpo-13349: repr object in tuple.index ValueError message May 27, 2017
@brettcannon
Copy link
Member

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).

@serhiy-storchaka
Copy link
Member

bpo-13349 was closed. The idea was rejected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants