Skip to content

Instantly share code, notes, and snippets.

@yanik-ai
Created March 17, 2015 16:55
Show Gist options
  • Save yanik-ai/a4fccb14153fcb123116 to your computer and use it in GitHub Desktop.
Save yanik-ai/a4fccb14153fcb123116 to your computer and use it in GitHub Desktop.
# 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