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

Michael Hudson mwh21@cam.ac.uk
30 Nov 2000 18:47:37 +0000


"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