Here's an example you might want to consider:
>>> from collections import namedtuple
>>> Point = namedtuple('Point', ['x', 'y'])
>>> Point(1, 2)
Point(x=1, y=2)
>>> Point(1, 2) == (1, 2)
True
>>> Polar = namedtuple('Polar', ['r', 'theta'])
>>> Polar(1, 2)
Polar(r=1, theta=2)
>>> Polar(1, 2) == (1, 2)
True
>>> Point(1, 2) == Polar(1, 2)
True
>>> hash(Point(1, 2)) == hash(Polar(1, 2)) == hash((1, 2))
True
--
Jonathan
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/Z5QX4YD7AL7WZXNUWTTRZIOHCLBJMPAT/
Code of Conduct: http://python.org/psf/codeofconduct/