[Python-Dev] surprising bug in s.capitalize()?
M.-A. Lemburg
mal@lemburg.com
Thu, 30 Nov 2000 19:56:45 +0100
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/