Live data from Hacker News

Delorean – datetime conversions in Python

delorean.readthedocs.org

1–10 of 42 posts

Re: Delorean – datetime conversions in Python

#4
I'm not a fan of the name (or the entire syntax really, but the non-descriptive name is the worst bit). python is generally pretty self-documenting, but calling 'Delorean' to convert times is totally obscure. using datetime and pytz.timezone is a few too many steps at times, but at least it is readable. This is just magic.

`return utc.localize(datetime.utcnow()).astimezone(est)` is maybe a little annoying to type out, but it's obvious what it does. `return Delorean(est)` doesn't make any sense at all.

Re: Delorean – datetime conversions in Python

#5
Slightly off topic: does anybody know why timezones are not firmly isolated within the presentation layer (more specifically, in the string formatting functions) rather than being part of the datetime object? (datetime in Python, DateTime in C#).

In other words why this sentence could be wrong: Timezones are a presentation-layer problem! http://news.ycombinator.com/item?id=5083321

Re: Delorean – datetime conversions in Python

#6
post #4

I'm not a fan of the name (or the entire syntax really, but the non-descriptive name is the worst bit). python is generally pretty self-documenting, but calling 'Delorean' to convert times is totally obscure. using datetime and pytz.timezone is a few too many steps at times, but at least it is readable. This is just magic. `return utc.localize(datetime.utcnow()).astimezone(est)` is maybe a little annoying to type out…

So the library does a little bit more than just deal with shifting timezones which as you put can be a little annoying.

I would take a look at the docs and see what else the library can provide before you start quoting the interface incorrectly. :)

As for the name I considered other things most lead to namespace pollution. You are right I might be able to clear up the reference for people who dont know "Back to the Future" series.

Re: Delorean – datetime conversions in Python

#7
First, I'd like to encourage the author - please keep iterating and keep the functionality coming. There is certainly a lot that can be done to make working with dates easier.

That said, this is just not very impressive right now. The dateutil module is much more useful: http://labix.org/python-dateutil

Re: Delorean – datetime conversions in Python

#8
Every time I do something involving with timezones in Python I find myself having to figure out the API again from scratch - it just doesn't fit in my brain. Having read the docs for this it appears to cover everything I ever want to do in a much more obvious way. Thanks very much!

Re: Delorean – datetime conversions in Python

#9
post #7

First, I'd like to encourage the author - please keep iterating and keep the functionality coming. There is certainly a lot that can be done to make working with dates easier. That said, this is just not very impressive right now. The dateutil module is much more useful: http://labix.org/python-dateutil

I appreciate the encouragement. What would be much more useful is some actual feedback. :)

I have baked in some of the niceties of dateutil into Delorean, such as rrule and parse.

Re: Delorean – datetime conversions in Python

#10
post #8

Every time I do something involving with timezones in Python I find myself having to figure out the API again from scratch - it just doesn't fit in my brain. Having read the docs for this it appears to cover everything I ever want to do in a much more obvious way. Thanks very much!

Thank you!
Post reply on HN