Created
July 28, 2013 00:40
-
-
Save elpargo/6096893 to your computer and use it in GitHub Desktop.
Make the ruby idiom foo.days.ago work in python.
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
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 |
giving a "Like" to previous comment.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great!. Everyone wants to be like ruby...