Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This comment has been minimized.
This comment has been minimized.
Oh yes, that one! It gets better though:
The reason is that the constants used here are stored in the function object, where they're deduplicated:
So inside the function both the literals are looked up as the same constant. There is basically zero behaviour you can count on for when two numbers are going to be reference equal in Python. |
This comment has been minimized.
This comment has been minimized.
Similar things are not always similar.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
Thanks for sharing. There is one inconsistency, which is my favorite)