Created
March 17, 2015 16:55
-
-
Save yanik-ai/a4fccb14153fcb123116 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# allow compare datetime.datetime and datetime.date types | |
def by_date_and_datetime(x): | |
if isinstance(x.date, datetime.datetime): | |
return x.date.date() | |
else: | |
return x.date | |
return sorted(profit_transactions + done_transactions, | |
key=by_date_and_datetime, reverse=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment