From charlesreid1

Revision as of 22:15, 27 March 2017 by Admin (talk | contribs) (Created page with "Python sorting: https://wiki.python.org/moin/HowTo/Sorting Python sorted containers: http://www.grantjenks.com/docs/sortedcontainers/ Python bintrees implementation of dicti...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Python sorting: https://wiki.python.org/moin/HowTo/Sorting

Python sorted containers: http://www.grantjenks.com/docs/sortedcontainers/

Python bintrees implementation of dictionaries and lists: https://pypi.python.org/pypi/bintrees

>>> Student.__eq__ = lambda self, other: self.age == other.age
>>> Student.__ne__ = lambda self, other: self.age != other.age
>>> Student.__lt__ = lambda self, other: self.age < other.age
>>> Student.__le__ = lambda self, other: self.age <= other.age
>>> Student.__gt__ = lambda self, other: self.age > other.age
>>> Student.__ge__ = lambda self, other: self.age >= other.age
>>> sorted(student_objects)
[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]