A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-December/041472.html below:

[Python-Dev] str.ascii_lower

[Python-Dev] str.ascii_lower [Python-Dev] str.ascii_lowerMartin v. Loewis martin at v.loewis.de
Mon Dec 29 12:59:18 EST 2003
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 ascii_lower(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


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4