Re: [Python-Dev] surprising bug in s.capitalize()?
"M.-A. Lemburg" <mal@lemburg.com> writes:
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.
Yes.
Here's what the string.py module has to say about this BTW:
I said "string_capitalize", i.e. "stringobject.c:string_capitalize", i.e I think
'aAaA'.capitalize()
should result in 'AAaA' We're not doing too well at understanding each other today, are we?
Note that .title() is very similar to the way string.capitalize() works. unicode.title() also uses the title case information available for Unicode characters.
Ah yes. So in the interests of reducing redunancy, .capitalize should probably do something usefully different... Cheers, M. -- 59. In English every word can be verbed. Would that it were so in our programming languages. -- Alan Perlis, http://www.cs.yale.edu/homes/perlis-alan/quotes.html
Michael Hudson wrote:
"M.-A. Lemburg" <mal@lemburg.com> writes:
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.
Yes.
Here's what the string.py module has to say about this BTW:
I said "string_capitalize", i.e. "stringobject.c:string_capitalize",
The string methods were built closely after the string module functions, so that's what the reference is...
i.e I think
'aAaA'.capitalize()
should result in
'AAaA'
We're not doing too well at understanding each other today, are we?
:)
Note that .title() is very similar to the way string.capitalize() works. unicode.title() also uses the title case information available for Unicode characters.
Ah yes. So in the interests of reducing redunancy, .capitalize should probably do something usefully different...
Depends... we'll still need some sort of compatibility with string.py. -- Marc-Andre Lemburg ______________________________________________________________________ Company: http://www.egenix.com/ Consulting: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/
i.e I think
'aAaA'.capitalize()
should result in
'AAaA'
No. The capitalize() method, which descends from the string.capitalize(), and which definitely should return 'Aaaa' here. This means that (a) the documentation needs some clarification, and (b) the Unicode capitalize() method is broken and needs to be fixed. --Guido van Rossum (home page: http://www.python.org/~guido/)
participants (3)
-
Guido van Rossum
-
M.-A. Lemburg
-
Michael Hudson