On Thu, Jan 31, 2019 at 8:23 AM Abe Dillon <abedil...@gmail.com> wrote: > > > Capitalizing constants may be slightly harder to read but constants in code > > are the minority and emphasizing them is precisely the point. > > The question I'm trying to get everyone to actually think about: > > Is the communication of constancy via ALL CAPS so important that it must be > in PEP-8 despite the documented harm that all caps does to readability? > > ttps://www.mity.com.au/blog/writing-readable-content-and-why-all-caps-is-so-hard-to-read > https://en.wikipedia.org/wiki/All_caps#Readability > https://uxmovement.com/content/all-caps-hard-for-users-to-read/ > https://practicaltypography.com/all-caps.html
Nobody is saying that the *entire document* should be in all caps. This is a specific token, a specific identifier. Are English paragraphs hard to read because tokens like "HTML" and "IBM" are in all-caps? > If socket.AF_INET6 were socket.af_inet6 would you consider re-binding that > variable? Would you be worried that other code will re-bind it? Can you > measure the value of the information conveyed by all-caps? Are you so sure > that it's as important as you think? > With constants that are taken directly from C, consistency is extremely helpful. Why is it called AF_INET6? Because it has exactly the same as AF_INET6 in C, or any other language that also has derived its socket handling from BSD sockets. (Which, for reference, is basically every language that has any sort of socket support.) > I've gotten a lot of responses like, "If you don't like it just ignore PEP-8, > it's not mandatory". > A) It is mandatory in many cases. That is not PEP 8's problem. The document stipulates that it is the standard for the Python standard library, nothing else. Are you going to appeal to Google to have *their* style guide changed too? A lot of people have adopted Google's style guide, and it explicitly says that module level constants *must* be in all caps. > B) We could just as easily NOT prescribe all caps in PEP-8 but still allow > it. In other words: you can use all caps if you want to but it's not > mandatory or in PEP-8. I would like to discourage its use, but we don't have > to go so far. That way nobody has to violate PEP-8. > I don't think PEP 8 actually mandates that *all* constants be written in all caps. It says "usually". But you have many options here - ignore PEP 8, treat PEP 8 as a guideline, or just accept that ALL_CAPS_CONSTANTS actually do carry useful information in their names. ChrisA _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/