[Python-Dev] str.ascii_lower (original) (raw)
Martin v. Loewis martin at v.loewis.de
Mon Dec 29 12:59:18 EST 2003
- Previous message: [Python-Dev] str.ascii_lower
- Next message: [Python-Dev] str.ascii_lower
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Guido van Rossum wrote:
But shouldnt' this work just as well if it's only for encoding names (which I'd hope would be ASCII themselves):
def asciilower(s): return str(unicode(s).lower())
Certainly. Another implementation would be
lower_map = string.maketrans(string.ascii_upper, string.ascii_lower) def ascii_lower(str): return str.translate(lower_map)
This seems more elegant than adding yet more methods to the str type.
Ok. I'll fix it in this direction, then. There would be two copies of this function that I can see: One for the codecs (which uses tolower() in C code), and one in the email module.
And yes, codec names must be pure ASCII.
Regards, Martin
- Previous message: [Python-Dev] str.ascii_lower
- Next message: [Python-Dev] str.ascii_lower
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]