pygame - importing GL - very bad...

someone newsboost at gmail.com
Tue Jan 1 18:50:04 EST 2013


On 01/01/2013 01:56 PM, Peter Otten wrote:
 > someone wrote:

 > It turns out pylint is lying. The situation is equivalent to
 >
 > $ cat module.py
 > for format in [42]:
 >      pass
 > del format
 >
 > $ cat main.py
 > original_format = format
 > from module import *
 > assert format is original_format
 > $ python main.py
 >
 > The assert doesn't trigger, so format is not redefined. But pylint 
complains
 > anyway:
 >
 > $ pylint main.py -rn
 > No config file found, using default configuration
 > ************* Module main
 > W:  2: Redefining built-in 'format'
 > C:  1: Missing docstring
 > C:  1: Invalid name "original_format" (should match (([A-Z_][A-Z0-9_]*)|
 > (__.*__))$)
 > W:  2: Wildcard import module
 >
 > If you can ignore the warning about the wildcard import you should be 
able

In the case of opengl import, I'll ignore the wildcard import warning. 
But in other cases I'll likely look a bit into it and see if I can avoid 
it or at least change it to something like: "import OpenGL.GL as GL" etc.

 > to ignore the "redefining built-in" warning, too. Personally I would 
avoid
 > putting magic comments like
 >
 > from module import * # pylint: disable=W0622

Oh, I just learned something new now... How come I cannot type "#pylint: 
enable=W0622" in the line just below the import ?

Not so intuitively/logically for me...

 > $ pylint main.py -rn
 > No config file found, using default configuration
 > ************* Module main
 > I:  2: Locally disabling W0622
 > C:  1: Missing docstring
 > C:  1: Invalid name "original_format" (should match (([A-Z_][A-Z0-9_]*)|
 > (__.*__))$)
 > W:  2: Wildcard import module
 >
 > into the code.

Thank you very much...

Another thing is that I don't understand this warning:

Invalid name "original_format" (should match (([A-Z_][A-Z0-9_]*)|
 > (__.*__))$)

I get it everywhere... I don't understand how it wants me to label my 
variables... Maybe I should disable this warning to get rid of it...






More information about the Python-list mailing list