On Wed, 02 Jan 2013 09:26:32 -0500, Dave Angel wrote: > On 01/02/2013 09:09 AM, someone wrote: >> On 01/02/2013 01:07 PM, Peter Otten wrote:
>>> pylint wants global names to be uppercase (what PEP 8 recommends for >>> constants) or "special" (two leading and two trailing underscores): >>> >>> THATS_OK = 42 >>> __thats_ok_too__ = object() >>> but_thats_not = "spam" >> >> OMG... I don't want to type those underscores everywhere... Anyway, >> thank you very much for explaining the meaning of what it wants... >> >> >> >> > Global const values should be ALL_CAPS, so it's obvious that nobody > intends to modify them. Like math.pi I suppose? *wink* > It's the non-const global attributes that expect to be underscored. Pylint is wrong here. The double-leading-and-trailing-underscore naming scheme is reserved for Python itself. PEP 8 explicitly states not to invent your own "dunder" names: __double_leading_and_trailing_underscore__: "magic" objects or attributes that live in user-controlled namespaces. E.g. __init__, __import__ or __file__. Never invent such names; only use them as documented. The section on global variables does not say to use dunder names: http://www.python.org/dev/peps/pep-0008/#id31 If pylint says that global variables should be named like "__variable__", that is explicitly going against PEP 8. > You shouldn't have to use those underscores very often. After all, > there is seldom a need for a non-const global value, right? Don't think > of it as a pylint problem, but as a hint from pylint that perhaps you > should use fewer globals. That at least is good advice. -- Steven -- http://mail.python.org/mailman/listinfo/python-list