You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to test, "constants" inside functions are forbidden.
But there is no evidence of such rule in PEP8, except the statement
constants are usually defined on a module level
Which is definetely don't forbid function-level constant. It could be if it was said always
I've been arguing the topic with my teammate, and never found any direct prohibition for function-level constants. Finally, he sent me a link to this test.
I'd be very glad if you proof me wrong by pointing to direct or implicit prohibition of constants usage inside of functions/methods in PEP. Or proof me right and update test (though I currently have no idea how to separate simple variable assignemnt from "constant" definition.
class TestCase:
def test_1:
URL = <some_value_for_1st_test>
... URL usage (may be multiple times)
def test_2:
URL = <some_value_for_2nd_test>
... URL usage (may be multiple times)
I'm pretty sure that the given case is PEP-compliant and semantycally correct - it's absolutely essential to treat some values as constant inside test case and emphasize it's immutability. For example if I define dataset to make checks against it.
The text was updated successfully, but these errors were encountered:
Oh my God, just drop the part about debates and give me please an answer,
whether or not it's a bug in your code (and there is a direct prohibition
in pep).
Thanks
сб, 8 дек. 2018 г., 2:46 Ian Stapleton Cordasco notifications@github.com:
pep8-naming/testsuite/N806.py
Line 18 in 6fc2dc6
According to test, "constants" inside functions are forbidden.
But there is no evidence of such rule in PEP8, except the statement
Which is definetely don't forbid function-level constant. It could be if it was said always
I've been arguing the topic with my teammate, and never found any direct prohibition for function-level constants. Finally, he sent me a link to this test.
I'd be very glad if you proof me wrong by pointing to direct or implicit prohibition of constants usage inside of functions/methods in PEP. Or proof me right and update test (though I currently have no idea how to separate simple variable assignemnt from "constant" definition.
Just for example, one of the cases is:
versus
I'm pretty sure that the given case is PEP-compliant and semantycally correct - it's absolutely essential to treat some values as constant inside test case and emphasize it's immutability. For example if I define dataset to make checks against it.
The text was updated successfully, but these errors were encountered: