MarkusH / bvg-grabber

Querying the upcoming public transport departures in Berlin
BSD 3-Clause "New" or "Revised" License
28 stars 6 forks source link

Implement sorting for departures #1

Closed MarkusH closed 11 years ago

MarkusH commented 11 years ago

Applications might want to sort a list of bvggrabber.api.Departure. We should simply implement the rich comparison methods.

http://docs.python.org/3/reference/datamodel.html#object.__lt__ http://docs.python.org/3/reference/datamodel.html#object.__le__ http://docs.python.org/3/reference/datamodel.html#object.__eq__ http://docs.python.org/3/reference/datamodel.html#object.__ne__ http://docs.python.org/3/reference/datamodel.html#object.__gt__ http://docs.python.org/3/reference/datamodel.html#object.__ge__

For simplification we should consider using http://docs.python.org/3/library/functools.html#functools.total_ordering .