.title() - annoying mistake

dn PythonList at DancesWithMice.info
Fri Mar 19 16:29:21 EDT 2021


On 20/03/2021 06.17, Chris Angelico wrote:
> On Sat, Mar 20, 2021 at 4:01 AM Abdur-Rahmaan Janhangeer
> <arj.python at gmail.com> wrote:
>>
>> It's about unnecessary capitalisation for a common use case
>> in English.
>>
>> You can see it in action on my site:
>> https://www.compileralchemy.com/#articles
>>
>> see 24.
>>
> 
> If you want something that's designed for English, get something
> that's designed for English. The string method is deliberately
> language-agnostic and simple.


There is an (unintended) 'psychological trap' here - that the
documentation is in English, but that the feature's application is
language-agnostic.


Perhaps the bigger trap is "SODD"! (Stack Overflow-Driven Development -
dn patent pending) Specifically, from where do we learn, the
authoritative (or otherwise) nature of our source(s), and how effective
that learning-process?

Recently, my grumpy-old-man status rose a notch, when I received a
'Finxter' email-advertisement offering a course in "all" of the Python
built-in functions. The advert claimed that this new offering was the
first time such a course& had been offered. Quite aside from such
teaching being contrary to theories of learning (other than rote), IMHO,
this claim seemed specious. A casual web-search rapidly revealed the
falsehood, by reminding me of a Udemy offering& and Techvidian's& -
amongst others. NB such evidence making the advertisement illegal in
this jurisdiction (albeit not many others)!

Applying such concerns to our str.title() conversation, a quick-fire
web-search quickly offers W3School's entry&, which is typical of the
genre (that I have conflated under the title "SODD").

If you'd care to repeat the experiment (& refs below), you will find
that this web-page (and its ilk) offer a quick way to remind oneself of
the syntax and purpose of the function, as needed. However, its brief
description is insufficient for learning - and totally-inappropriate
when it comes to helping the OP! The 'psychological trap' inherent in
these is the fallacy of apparent sufficiency - that the 'answer' might
be complete, and therefore the impression that there is nothing left to
learn. Whither their value?


Compare that/them with the Python documentation& (per @Paul's post). Not
only do we have the 'quick reminder' capability, but also the warning -
and further a sample work-around. Here we have "authority" and
"completeness" (and an open-source philosophy of enabling improvement).

The 'docs' team work very hard on our behalf. Not only do they deserve
our 'support' as readers, but such is also a more worthwhile investment
in our own learning!


BTW when programming, I will keep the Python Documentation web-page as
an open tab in my web-browser, precisely to facilitate such rapid
look-ups/reminders. Although, these days, editors/IDEs probably satisfy
the majority of such needs. In addition, the DuckDuckGo search engine
offers a "bang lookup" (short-cut) to the Python docs search page, ie
"!py .title()" realises
"https://docs.python.org/3/search.html?q=.title()" and thus gives
pointers to str.title() plus the bytes and turtle methods of the same
name - additionally to str.istitle() which is the inspection 'companion'
to the 'do it' function we've been discussing!

As many GPS-users have found to their cost, placing your reliance upon a
tool whose objective is 'convenience', can lead you "down the garden path"&!


& Web.Refs:
https://academy.finxter.com/university/python-built-in-functions-every-python-coder-must-know/
(https://www.udemy.com/course/the-python-built-in-function-tutorial-series/)
(https://techvidvan.com/tutorials/python-built-in-functions/)
https://www.w3schools.com/python/ref_string_title.asp
https://docs.python.org/3.9/library/stdtypes.html#str.title
https://idioms.thefreedictionary.com/lead+down+the+garden+path
-- 
Regards,
=dn


More information about the Python-list mailing list