Skip to content

Instantly share code, notes, and snippets.

@elpargo
Created July 28, 2013 00:40
Show Gist options
  • Save elpargo/6096893 to your computer and use it in GitHub Desktop.
Save elpargo/6096893 to your computer and use it in GitHub Desktop.
Make the ruby idiom foo.days.ago work in python.
from forbiddenfruit import curse
from datetime import timedelta,datetime
curse(int,'days',property(lambda s:timedelta(s)))
(12).days
curse(timedelta,'ago',property(lambda s:datetime.now()-s))
print (12).days.ago
@hminaya
Copy link

hminaya commented Jul 28, 2013

Great!. Everyone wants to be like ruby...

@gpopoteur
Copy link

giving a "Like" to previous comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment