How do you PEP 8-name a class whose name is an acronym? How do you PEP 8-name a class whose name is an acronym? python python

How do you PEP 8-name a class whose name is an acronym?


PEP-8 does cover this (at least partially):

Note: When using abbreviations in CapWords, capitalize all the letters of the abbreviation. Thus HTTPServerError is better than HttpServerError.

Which I would read to mean that NASAJPL() is the recommended name according to PEP-8.

Personally I'd find NasaJpl() the easiest to scan since the upper case letters easily mark word boundaries and give the name a distinctive shape.


As others have noted, NASAJPL is probably the PEP-8 approved form.

Just to be contrary, however, I would probably use NasaJPL. Because if you are reading it, you pronounce "NASA" as a single word, whereas "JPL" you spell out.

You can make an argument that this is consistent with PEP-8, since "NASA" is an acronym, but "JPL" is an abbreviation (or initialism, if you want to get pedantic).


#1 in this particular case looks fine to me (if it's really an acronym). Out of curiosity, what does it stand for (and what exactly is the class instance, maybe a module would be the more appropriate divisor)?

class NASAJPL:

EDIT: when you're combining two acronyms chances are you want to divide functionality over modules (you never know when you're adding that next feature to your program):

from NASA import JPLfrom NASA import ARC