.title() - annoying mistake

Schachner, Joseph Joseph.Schachner at Teledyne.com
Fri Mar 19 14:13:49 EDT 2021


I agree.  If the documentation notes this issue, and the (possibly new) Python user has to replace the .title() with a different function that uses regular expression and a lambda function to work around the issue, then perhaps it's time for a proposal to address this.  Perhaps there needs to be an optional argument to .title() which if supplied should tell it do the workaround.   Or, perhaps better, only capitalize the first word and subsequent words that are preceded by a white space.  That should solve "Someone's Apostrophe" and "Hyphenated-expressions". Someone who looks into this should check if the second part of a hyphenated expression needs to be capitalized. 

--- Joseph S.   


Teledyne Confidential; Commercially Sensitive Business Data

-----Original Message-----
From: Abdur-Rahmaan Janhangeer <arj.python at gmail.com> 
Sent: Friday, March 19, 2021 11:02 AM
To: Paul Bryan <pbryan at anode.ca>
Cc: Python <python-list at python.org>
Subject: Re: .title() - annoying mistake

Thanks very much!

That's annoying. You have to roll your own solution!

Kind Regards,

Abdur-Rahmaan Janhangeer
about <https://compileralchemy.github.io/> | blog <https://www.pythonkitchen.com> github <https://github.com/Abdur-RahmaanJ>
Mauritius

>


More information about the Python-list mailing list