<div dir="ltr"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">All-caps does *not* signify "don't override this".</blockquote><div>PEP-8 specifically says to use all caps to signify constants. What exactly do you think the word "constant" means? I know very well Python doesn't support actual constants and that anything can be overridden.<br><br>Your example goes against the convention of using all caps to signify constants and it's a bad design all around. You would be better off with:<br><br><font face="monospace, monospace" color="#000000" style="background-color:rgb(255,255,255)">def get_emote_lits(root = <span style="box-sizing:border-box;font-size:12px;white-space:pre">os</span><span style="font-size:12px;white-space:pre">.</span><span style="box-sizing:border-box;font-size:12px;white-space:pre">path</span><span style="font-size:12px;white-space:pre">.</span><span style="box-sizing:border-box;font-size:12px;white-space:pre">normpath</span><span style="font-size:12px;white-space:pre">(</span><span class="gmail-pl-c1" style="box-sizing:border-box;font-size:12px;white-space:pre">__file__</span><span style="font-size:12px;white-space:pre"> </span><span class="gmail-pl-k" style="box-sizing:border-box;font-size:12px;white-space:pre">+</span><span style="font-size:12px;white-space:pre"> </span><span class="gmail-pl-s" style="box-sizing:border-box;font-size:12px;white-space:pre"><span class="gmail-pl-pds" style="box-sizing:border-box">"</span>/../emotes<span class="gmail-pl-pds" style="box-sizing:border-box">"</span></span></font><span style="white-space:pre"><font face="monospace, monospace" style="font-size:12px;background-color:rgb(255,255,255)" color="#000000">)):
  ... # congratulations, you've re-invented the default parameter in a more clunky way!</font><font color="#24292e" style="font-size:12px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;background-color:rgb(255,251,221)">

</font><font style="background-color:rgb(255,255,255)" color="#000000" face="arial, helvetica, sans-serif">I don't know many APIs built around having you fiddle with module-level variables, it seems like an anti-pattern to me.

</font></span><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">If "don't change this externally" is the default, why would we have a<br>naming convention meaning "don't change this externally"? </blockquote><font style="background-color:rgb(255,255,255)" color="#000000" face="arial, helvetica, sans-serif"><span style="white-space:pre">Modules and Classes and functions typically expose functionality while the purpose of most other objects is to encapsulate state,</span></font></div><div><font style="background-color:rgb(255,255,255)" color="#000000" face="arial, helvetica, sans-serif"><span style="white-space:pre">so it makes sense that attributes would be read/write by default, though some even disagree on that point.</span>
<span style="white-space:pre">I'm not a hard-core functional programming fanatic, so I'm not about to argue that everything should be read-only by default.</span></font></div><div><font style="background-color:rgb(255,255,255)" color="#000000" face="arial, helvetica, sans-serif"><span style="white-space:pre">I also think you're playing dumb to avoid confronting my point:

If you found that there was an undocumented module-level attribute in pandas, what would be your initial assumption?
If it's not all caps, is it fair game to override it? Can you re-write your emote code so that it's clear that the emote-path variable is part of the API *without* any documentation?
How much does all caps really communicate?</span></font></div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Jan 4, 2019 at 7:16 PM Chris Angelico <<a href="mailto:rosuav@gmail.com">rosuav@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Sat, Jan 5, 2019 at 11:58 AM Abe Dillon <<a href="mailto:abedillon@gmail.com" target="_blank">abedillon@gmail.com</a>> wrote:<br>
> You made EMOTE_PATH all caps signifying it's a constant, then added a comment saying that it "Can be overwritten prior to calling get_emote_list".<br>
><br>
> So not only was your naming convention, on its own, insufficient to explain the API of your code, but you're completely violating PEP-8 because your using the constancy convention on something that's not constant. That's 100% counterintuitive. You subvert the one thing that all-caps is supposed to communicate.<br>
><br>
<br>
If "don't change this externally" is the default, why would we have a<br>
naming convention meaning "don't change this externally"? I think<br>
you're misunderstanding the way that module constants are used in<br>
Python. They CAN be overridden. That is part of the point. All-caps<br>
does *not* signify "don't override this".<br>
<br>
ChrisA<br>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/codeofconduct/</a><br>
</blockquote></div>