Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'nasty': 0.07; 'python': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'ignore': 0.13; "hasn't": 0.15; '(line': 0.16; '(should': 0.16; '-rn': 0.16; 'commented': 0.16; 'complains': 0.16; 'docstring': 0.16; 'lying.': 0.16; 'program...': 0.16; 'pygame': 0.16; 'received:80.91.229.3': 0.16; 'received:dip.t-dialin.net': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-dialin.net': 0.16; 'scope.': 0.16; "variable's": 0.16; 'wrote:': 0.17; 'config': 0.17; 'found,': 0.17; 'module': 0.19; 'code.': 0.20; 'equivalent': 0.20; 'putting': 0.20; 'import': 0.21; 'thanks.': 0.21; 'defined': 0.22; 'pass': 0.25; 'header:User-Agent:1': 0.26; "doesn't": 0.28; 'header:X-Complaints-To:1': 0.28; 'skip:( 20': 0.28; 'run': 0.28; 'assert': 0.29; 'cat': 0.29; 'clever': 0.29; 'disabling': 0.29; "i'm": 0.29; 'stuff': 0.30; 'code': 0.31; 'file': 0.32; 'could': 0.32; 'comments': 0.33; 'turns': 0.33; 'to:addr:python-list': 0.33; 'updated': 0.34; 'built-in': 0.35; 'problem,': 0.35; 'too.': 0.35; 'received:org': 0.36; 'but': 0.36; 'url:org': 0.36; 'should': 0.36; 'why': 0.37; 'subject:: ': 0.38; 'from:': 0.38; 'to:addr:python.org': 0.39; 'skip:" 10': 0.40; 'header:Received:5': 0.40; 'personally': 0.61; 'first': 0.61; 'situation': 0.62; 'subject:...': 0.63; 'therefore': 0.65; 'locally': 0.84; 'reports:': 0.84; 'tell:': 0.84; 'this...': 0.84; 'redefining': 0.91; 'subject:very': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Peter Otten <__peter__@web.de> Subject: Re: pygame - importing GL - very bad... Date: Tue, 01 Jan 2013 13:56:41 +0100 Organization: None References: Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Gmane-NNTP-Posting-Host: p5084b3f4.dip.t-dialin.net User-Agent: KNode/4.7.3 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 74 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1357044999 news.xs4all.nl 6918 [2001:888:2000:d::a6]:54128 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:35887 someone wrote: > See this code (understand why I commented out first line): > > # from OpenGL.GL import * > from OpenGL.GL import glEnable, GL_DEPTH_TEST, \ > glShadeModel, GL_SMOOTH, glClearColor, \ > GL_CULL_FACE, GL_BLEND, glBlendFunc, \ > GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, \ > glClear, GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT, \ > glLoadIdentity, glTranslate, glRotate, \ > glMultMatrixf, glPushMatrix, glCallList, \ > glPopMatrix, glDisable, GL_LIGHTING > > The reason why I commented out the first line is that I use "pylint" and > it reports: "[W] Redefining built-in 'format'" for this line. > > From: http://www.logilab.org/card/pylintfeatures tell: > W0621: Redefining name %r from outer scope (line %s) Used when a > variable's name hide a name defined in the outer scope. > > I don't like to redefine already defined names so therefore I had to > outcomment first line and then keep on adding stuff until I could run my > program... But this SUCKS! I can see that pygame hasn't been updated for > a long while - not many users use it? I'm not very happy about this... > > Any good / clever solution to this problem, so I avoid this nasty crappy > work-around? > > Any ideas / suggestions ? > Thanks. 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 to ignore the "redefining built-in" warning, too. Personally I would avoid putting magic comments like from module import * # pylint: disable=W0622 $ 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.