-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow Chip and (x,y) to be interchangable as keys #230
Comments
For typing there would be Three types Chip - It is known or must be a Chip Object |
class Chip(object):
foo = dict() assert a == (2, 3) |
A major downside possibly even killer of this idea is that the dictionaries keys() and items() methods could not longer be relied on to return all Chips or all Tuples |
class Chip(object):
a = Chip(1, 3, "bacon") |
With the above where we want the dict to return (x, y) it can return Chip as (x, y) = chip works they same as (x, y) = xy Where the dict must return a Chip mypy should catch the put of an xy tuple. |
done in #246 |
We already have the notion that 2 Chip objects are considered equal if they have the same x and y
There also many case when the Chip object is only used to represent the x and y coordinates.
Currently we have to careful manage and think about when we have a Chip object and when we have a XY tuple
But do we really care?
It is technically possible to make the Chip(A,B) and the Tuple (A,B) to be "eq" and to return the same hash
Then we would not longer need to worry about when we have an XY and when we have a Chip.
The text was updated successfully, but these errors were encountered: