[ python-Bugs-1219840 ] Need locale arg to strftime()

SourceForge.net noreply at sourceforge.net
Mon Jul 11 05:10:09 CEST 2005


Bugs item #1219840, was opened at 2005-06-13 10:32
Message generated for change (Comment added) made by bcannon
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1219840&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.4
>Status: Closed
>Resolution: Invalid
Priority: 5
Submitted By: Wilfredo Sanchez (wsanchez)
Assigned to: Brett Cannon (bcannon)
Summary: Need locale arg to strftime()

Initial Comment:
strftime()'s behavior is dependant on your current locale.  Sometimes 
this is undesireable, such as when parsing HTTP dates (RFC 2068, 
3.3.1), where on is expected to create and parse dates using English 
month and week names.

A similar problem exists with the lower() string method.

In either case locale magic isn't always desirable, and it would be 
useful to add a locale argument to specify which locale to use.


----------------------------------------------------------------------

>Comment By: Brett Cannon (bcannon)
Date: 2005-07-10 20:10

Message:
Logged In: YES 
user_id=357491

Since no one can seem to refute my logic I am closing this
as invalid.

----------------------------------------------------------------------

Comment By: Brett Cannon (bcannon)
Date: 2005-06-14 19:14

Message:
Logged In: YES 
user_id=357491

There is an issue with this idea.  strftime() is just a wrapper around the 
ISO C library function.  We have no direct control over the locale 
handling.  This means that the locale used by strftime() is dictated by 
the locale that the ISO C libraries think you have.

Best thing to do is to temporarily change the locale to what you need, 
use strftime(), and then set the locale back.  PEP 342 would be nice for 
this.  =)  At best this is what strftime() would have to do behind the 
scenes for you.  And the extra overhead is not totally desirable.

----------------------------------------------------------------------

Comment By: Raymond Hettinger (rhettinger)
Date: 2005-06-14 01:59

Message:
Logged In: YES 
user_id=80475

Brett, do you want to take this one?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1219840&group_id=5470


More information about the Python-bugs-list mailing list