the Gravity of Python 2
Roy Smith
roy at panix.com
Wed Jan 8 22:44:50 EST 2014
In article <mailman.5227.1389238511.18130.python-list at python.org>,
Ben Finney <ben+python at benfinney.id.au> wrote:
> Chris Angelico <rosuav at gmail.com> writes:
>
> > On Thu, Jan 9, 2014 at 1:25 PM, Roy Smith <roy at panix.com> wrote:
> > > Because it's easy to get a naive one. You call datetime.utcnow(). If
> > > utcnow() returned an aware datetime, that's probably what we would
> > > be using. Why didn't utcnow() just return an aware datetime to begin
> > > with?
> [â¦]
>
> > But even so, the problem is not "why can't naive timestamps do
> > everything I want". The problem is "why is it so hard to get an aware
> > timestamp for the current instant". And if you ask *that* question,
> > then there's likely to be an answer.
>
> I think Roy's question hits close to a related problem: that the
> standard library makes it easy to do a sub-optimal thing, and the
> behaviour we all agree is best is not the default.
>
> So, two questions are raised. One is what you've correctly identified:
> âWhy is it so hard to get an aware timestamp for the current instant?â
> The short answer is: because doing that requires a lookup into a
> frequently-updated database, which (because it's so frequently updated)
> isn't installed along with Python.
We have a call in the standard library named utcnow(). That shouldn't
require a lookup in a database. "I'm sorry, which value of zero did you
want?"
More information about the Python-list
mailing list