Python Style Guide Questions - Contd.

koranthala koranthala at gmail.com
Mon Jan 19 08:50:54 EST 2009


Hi,
   I have some more questions about python code styling.
   1. Global Variables: In my code, I am using some global variables.
Now, when I ran PyLint, it raised convention errors mentioning that
they should be CAPITAL_ALPHABETS. Now, in PEP 8, I did not see that
mentioned. Please let me know whether that is the usual styling
mechanism which is used.
   2. I have many loops wherein I define a variable as just a counter.
       for x in range(counter):
          do_something()
       Please note that I am not using x anywhere in the program.
       Pylint again raises warnings saying that the variable should be
used.
       Should I disregard it or use the default variable _ ?
       for _ in range(counter):
          do_something()
       pylint does not raise errors for those. Are there any issues in
using _ ?



More information about the Python-list mailing list