[issue7008] str.title() misbehaves with apostrophes

2009-09-28 Thread Raymond Hettinger
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: I agree with the OP that str.title should be made smarter. As it stands, it is a likely bug factory that would pass unittests, then generate unpleasant results with real user inputs. Extending on Thomas's comment, I think

[issue7008] str.title() misbehaves with apostrophes

2009-09-28 Thread Thomas W. Barr
Thomas W. Barr t...@rice.edu added the comment: If correct handling of apostrophe's and quotation marks, keeping the string length unchanged, and only changing desired letters from lower to uppercase with no other side-effects is the criterion we want, then what I suggested (toupper() the first

[issue7008] str.title() misbehaves with apostrophes

2009-09-28 Thread Raymond Hettinger
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: I'm still researching what other languages do. MS-Excel matches what Python currently does. Django uses the python version and then fixes-up apostrophe errors: title=lambda value: re.sub(([a-z])'([A-Z]), lambda m:

[issue7008] str.title() misbehaves with apostrophes

2009-09-28 Thread Guido van Rossum
Guido van Rossum gu...@python.org added the comment: Raymond, please refrain from emotional terms like bug factory. I have nothing to say about whether string.capwords() should be removed, but I want to note that it does a split on whitespace and then rejoins using a single space, so that