[Python-ideas] AMEND PEP-8 TO DISCOURAGE ALL CAPS

Abe Dillon abedillon at gmail.com
Fri Feb 1 14:23:30 EST 2019


[Mike Miller]

> Another message here reminded me that the datetime classes are not named
> DateTime like they should be.


There are a few strange conventions in programming that seem almost
backwards. In prose, we capitalize proper nouns, but rarely class-type
nouns. Bullwinkle is a moose, not bullwinkle is a Moose. It seems the
built-ins like int, str, list, dict, etc. get it right, then it's reversed
for everything else.

[Mike Miller]

> Why not rename them, PI and E too, with suitable
> long-term deprecation period?
> (As it looks like ALL_CAPS is here to stay.)


There's a Java programming guideline at my workplace that you're supposed
to put "final" in-front of pretty much everything because it supposedly
makes code easier to reason about. I've since found that the Java community
largely supports this idea
<http://www.javapractices.com/topic/TopicAction.do?Id=23> (not just my
company), which raises the question, "why not make everything default to
'final' and put 'var' or something in-front of the few outliers?".

My default assumption for any variable not in the immediate scope is that
it's intended to be read-only unless the code I'm reading modifies it.
Maybe module-level variables and class-level variables should be all caps
if they're NOT constant because then I'd want them to yell at me that
they're a potential hazard.

Anyway, I thought others might find that to be mildly interesting food for
thought. Sorry for bumping this thread again...

On Fri, Feb 1, 2019 at 12:59 PM Mike Miller <python-ideas at mgmiller.net>
wrote:

>
> On 1/30/19 6:07 PM, David Mertz wrote:
> > On Wed, Jan 30, 2019, 4:23 PM Abe Dillon <abedillon at gmail.com
> > <mailto:abedillon at gmail.com> wrote:
> >
> >     Consider thatmath.pi and math.e are constants that are not all caps,
> have
> >     you ever been tempted to re-bind those variables?
> >
> >
> > I generally use 'from math import pi as PI' because the lower case is
> confusing
> > and misnamed.
>
>
> Another message here reminded me that the datetime classes are not named
> DateTime like they should be.  Why not rename them, PI and E too, with
> suitable
> long-term deprecation period?
>
> (As it looks like ALL_CAPS is here to stay.)
>
> -Mike
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20190201/d7aa5dad/attachment-0001.html>


More information about the Python-ideas mailing list