[Python-ideas] Reduce platform dependence of date and time related functions

Andrew Barnert abarnert at yahoo.com
Thu Sep 19 18:07:40 CEST 2013

On Sep 17, 2013, at 10:41, Alexander Belopolsky <alexander.belopolsky at gmail.com> wrote:

> On Tue, Sep 17, 2013 at 1:02 PM, Brett Cannon <brett at python.org> wrote:
>> As you pointed out, getting the locale details is essentially not possible in a cross-platform way unless you use strptime or strftime, so you have to choose which is implemented in Python and relies on the other.
> What we can do is to implement "C" locale behavior.  In fact, in many uses of strftime() its locale-dependence is a problem.  

But in many cases it's useful. And the platform doesn't give us any way to get enough information about the locale to implement it ourselves. It's the same reason we have naive local times--local times are useful, the platform doesn't give us enough information about the local timezone, so we have to use what it gives us.

> I would much rather have strftime_l()-like function and "C" locale implemented in stdlib.  

I agree that having both would be useful.

If you're suggesting renaming platform-dependent locale-handling strftime to strftime_l, and adding a new "C"-locale-only strftime, I don't like the naming. The function that acts just like the POSIX function strftime, and like the Python function in every version up to now, should be called strftime; give the new function a different name instead. Otherwise, I can't see a problem.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130919/d2cf2126/attachment-0001.html>

More information about the Python-ideas mailing list