I don’t know how to start this, so I’ll start at the beginning. Not in every application, but in most tutorials, you learn the method .capitalize(). Honestly, as you are learning what strings are, you see a bunch of examples like the following:

"LET mE USE the coRREct CapitalizaTion!".capitalize()

You play around with the different ways that .capitalize() works and don’t give it another thought. Let me throw a wrench into how .capitialize() (by default) works.

Try this out:

>>> "billy".capitalize()
>>> "JOHNNY".capitalize()
>>> "sUSAN".capitalize()
>>> "JJ".capitalize()
>>> "KJ".capitalize()

I call this the “little j” problem. It happens on nametags, software, and other systems that don’t understand that names can be two letters. The JJs’, AJs’, KCs’, TJs’, and NJs’ of the world exist, and it seems python doesn’t understand that.

Now I started to figure out how to propose this as a PEP to start this conversation to change the stdlib, but I got lost almost from the get-go. I’m posting this, so I have something to reference, and maybe just maybe, after I get this out there, someone will help me figure out where I can start asking to get us two-letter humans the correct capitalization.


After posting this to lobste.rs the user jaculabilis, came up with this idea:

def name_capitalize(s):
    return s.capitalize() if len(s) != 2 else s.upper()

It’s so beautifily simple, that at least I’ll be using it in some apps going forward. Thank you for the suggestion!