Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need locale arg to strftime() #42079

Closed
wsanchez mannequin opened this issue Jun 13, 2005 · 4 comments
Closed

Need locale arg to strftime() #42079

wsanchez mannequin opened this issue Jun 13, 2005 · 4 comments
Assignees
Labels
stdlib Python modules in the Lib dir

Comments

@wsanchez
Copy link
Mannequin

wsanchez mannequin commented Jun 13, 2005

BPO 1219840
Nosy @brettcannon, @rhettinger

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/brettcannon'
closed_at = <Date 2005-07-11.03:10:09.000>
created_at = <Date 2005-06-13.17:32:02.000>
labels = ['invalid', 'library']
title = 'Need locale arg to strftime()'
updated_at = <Date 2005-07-11.03:10:09.000>
user = 'https://bugs.python.org/wsanchez'

bugs.python.org fields:

activity = <Date 2005-07-11.03:10:09.000>
actor = 'brett.cannon'
assignee = 'brett.cannon'
closed = True
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2005-06-13.17:32:02.000>
creator = 'wsanchez'
dependencies = []
files = []
hgrepos = []
issue_num = 1219840
keywords = []
message_count = 4.0
messages = ['25534', '25535', '25536', '25537']
nosy_count = 3.0
nosy_names = ['brett.cannon', 'rhettinger', 'wsanchez']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue1219840'
versions = ['Python 2.4']

@wsanchez
Copy link
Mannequin Author

wsanchez mannequin commented Jun 13, 2005

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.

@wsanchez wsanchez mannequin closed this as completed Jun 13, 2005
@wsanchez wsanchez mannequin added the invalid label Jun 13, 2005
@wsanchez wsanchez mannequin assigned brettcannon Jun 13, 2005
@wsanchez wsanchez mannequin added the stdlib Python modules in the Lib dir label Jun 13, 2005
@wsanchez wsanchez mannequin closed this as completed Jun 13, 2005
@wsanchez wsanchez mannequin added the invalid label Jun 13, 2005
@wsanchez wsanchez mannequin assigned brettcannon Jun 13, 2005
@wsanchez wsanchez mannequin added the stdlib Python modules in the Lib dir label Jun 13, 2005
@rhettinger
Copy link
Contributor

Logged In: YES
user_id=80475

Brett, do you want to take this one?

@brettcannon
Copy link
Member

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.

@brettcannon
Copy link
Member

Logged In: YES
user_id=357491

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

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir
Projects
None yet
Development

No branches or pull requests

2 participants