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/2000-November/010828.html below:

[Python-Dev] surprising bug in s.capitalize()?

[Python-Dev] surprising bug in s.capitalize()? [Python-Dev] surprising bug in s.capitalize()?M.-A. Lemburg mal@lemburg.com
Thu, 30 Nov 2000 19:38:04 +0100
> Oooh, here's something a bit more serious though:
> 
> >>> u'aAaAaA'.capitalize()
> u'AAaAaA'
> 
> Something obviously Needs To Be Done.  My hunch is to change
> string_capitalize, but that may be just me (and probably Barry).

Ouch. That's a bug.

Here's what the string.py module has to say about this BTW:

# Capitalize a string, e.g. "aBc  dEf" -> "Abc  def".
def capitalize(s):
    """capitalize(s) -> string

    Return a copy of the string s with only its first character
    capitalized.

    """
    return s.capitalize()


Note that .title() is very similar to the way string.capitalize()
works. unicode.title() also uses the title case information available
for Unicode characters.

-- 
Marc-Andre Lemburg
______________________________________________________________________
Company:                                        http://www.egenix.com/
Consulting:                                    http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/



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