[CentralOH] Ugliest Line of Python Ever?
jonebird at gmail.com
Thu Oct 28 02:20:23 CEST 2010
I think I just typed the ugliest line of python code in iPython
ever?... and I don't mind sharing it since you might get a chuckle out
In : datetime.datetime(*[ int(x) for x in (game.gametime -
datetime.timedelta(hours=24)).strftime('%Y %m %d 12 0').split()])
Out: datetime.datetime(2010, 10, 27, 12, 0)
I was trying to create a datetime object for twelve noon on the
previous day before the game.
(game is the DB object and game.gametime should be pretty obvious)
I'm going to split it up for readability but I'm still don't have a
better way to do this.
-- Jon Miller
More information about the CentralOH