Closed glenfant closed 8 years ago
Thanks for your suggestion, @glenfant.
My take on this is that though a module of constants is a common and perfectly idiomatic thing in Python, I am not sure I am ready to suggest, generally, that numeric literals always be factored out of code. It's the kind of suggestion that, though well-intentioned, could lead to "cargo cult programming", IMO. But I appreciate you raising the issue.
All is a matter of good balance ;)
Thanks again @glenfant -- I'll close this issue since I don't think there are concrete changes to make to the guide based on this thread.
Numeric literals, other than -1, 0 and 1 should never appear in the code body. Use constants, preferably from a
config.py
like module if you're in a big package, or values used in various modules.This is not Python specific but I have lost so much time fixing bugs this ugly stuff yields...