I am comfortable with Java naming conventions where you are free to name your methods as long as it starts with lowercase so methodForTest()
is acceptable.
However, Python (PyCharm IDE) complains for this way and it requires all lowercase.
Why? Can I disable this so I can use uppercase in method naming?
Python has no such limitation.
Python identifiers must start with an underscore or letter (upper or lowercase), followed by any number of underscores, digits or letters (again, upper or lowercase, doesn't matter); this means an ALL_UPPERCASE name is perfectly valid Python. See the Identifiers and keywords section in the reference documentation; Python 3 expanded on this by allowing a wider range of Unicode.
However, the widely adopted PEP 8 Python styleguide does have this to say on naming functions:
Function names should be lowercase, with words separated by underscores as necessary to improve readability.
This is a convention however, not a syntactic requirement. Perhaps your IDE has a linter installed that warns when you break this convention. You can, if you so wish, ignore it. I note that PyCharm implements such a check, for example.
In PyCharm, you can click on the warning icon and tell PyCharm to ignore the class of errors:
Also see the PyCharm documentation on suppressing inspections.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With