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: m.group(0).lower(), value.title()). It would also be nice to handle hyphenates like "xray" --> "X-ray". Am thinking that it would be nice if the user could pass-in an optional argument to list all desired characters to prevent transitions (such as apostrophes and hyphens). A broader solution would be to replace string.capwords() with a more sophisticated set of rules that generally match what people are really trying to accomplish with title casing: http://aitech.ac.jp/~ckelly/midi/help/caps.html http://search.cpan.org/dist/Text-Capitalize/Capitalize.pm "Headline Style" in the Chicago Manual of Style or Associate Pressd Stylebook: http://grammar.about.com/b/2008/04/11/rules-for-capitalizing-the-words-in-a-title.htm Any such attempt at a broad solution needs to provide ways for users to modify the list of exception words and options for quoted text. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue7008> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com