Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #35887

Re: pygame - importing GL - very bad...

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 <python-python-list@m.gmane.org>
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 <kbufkg$ead$1@dont-email.me>
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 <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1513.1357044999.29569.python-list@python.org> (permalink)
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

Show key headers only | View raw


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.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-01 12:00 +0100
  Re: pygame - importing GL - very bad... Chris Angelico <rosuav@gmail.com> - 2013-01-01 22:13 +1100
    Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-02 00:49 +0100
      Re: pygame - importing GL - very bad... Michael Torrie <torriem@gmail.com> - 2013-01-02 14:57 -0700
        Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-03 02:53 +0100
          Re: pygame - importing GL - very bad... "Mike C. Fletcher" <mcfletch@vrplumber.com> - 2013-01-03 09:09 -0500
            Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-05 02:10 +0100
              Re: pygame - importing GL - very bad... Dave Angel <d@davea.name> - 2013-01-04 20:30 -0500
                Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-05 11:49 +0100
                Re: pygame - importing GL - very bad... Dave Angel <d@davea.name> - 2013-01-05 06:23 -0500
                Re: pygame - importing GL - very bad... Chris Angelico <rosuav@gmail.com> - 2013-01-05 22:47 +1100
                Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-05 14:06 +0100
                Re: pygame - importing GL - very bad... Chris Angelico <rosuav@gmail.com> - 2013-01-06 00:27 +1100
                Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-05 20:49 +0100
                Re: pygame - importing GL - very bad... alex23 <wuwei23@gmail.com> - 2013-01-06 03:37 -0800
                Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-06 13:46 +0100
      Re: pygame - importing GL - very bad... Andrew Berg <bahamutzero8825@gmail.com> - 2013-01-02 16:30 -0600
        Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-03 03:02 +0100
  Re: pygame - importing GL - very bad... Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-01 11:49 +0000
    Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-02 00:49 +0100
      Re: pygame - importing GL - very bad... Nobody <nobody@nowhere.com> - 2013-01-02 03:01 +0000
        Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-02 04:43 +0100
        Re: pygame - importing GL - very bad... alex23 <wuwei23@gmail.com> - 2013-01-02 01:52 -0800
          Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-02 15:04 +0100
      Re: pygame - importing GL - very bad... Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-02 07:39 +0000
        Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-02 15:06 +0100
  Re: pygame - importing GL - very bad... Peter Otten <__peter__@web.de> - 2013-01-01 13:56 +0100
    Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-02 00:50 +0100
      pylint, was Re: pygame - importing GL - very bad... Peter Otten <__peter__@web.de> - 2013-01-02 13:07 +0100
        Re: pylint, was Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-02 15:09 +0100
          Re: pylint, was Re: pygame - importing GL - very bad... Dave Angel <d@davea.name> - 2013-01-02 09:26 -0500
            Re: pylint, was Re: pygame - importing GL - very bad... Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-02 23:52 +0000
              Re: pylint, was Re: pygame - importing GL - very bad... Ian Kelly <ian.g.kelly@gmail.com> - 2013-01-02 17:25 -0700
              Re: pylint, was Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-03 03:24 +0100
                Re: pylint, was Re: pygame - importing GL - very bad... Terry Reedy <tjreedy@udel.edu> - 2013-01-02 21:48 -0500
                Re: pylint, was Re: pygame - importing GL - very bad... Ian Kelly <ian.g.kelly@gmail.com> - 2013-01-02 19:55 -0700
                Re: pylint, was Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-03 12:19 +0100
                Re: pylint, was Re: pygame - importing GL - very bad... Chris Angelico <rosuav@gmail.com> - 2013-01-03 22:27 +1100
                Re: pylint, was Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-05 02:11 +0100
                Re: pylint, was Re: pygame - importing GL - very bad... Jan Riechers <janpeterr@freenet.de> - 2013-01-05 14:49 +0200
                Re: pylint, was Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-05 14:09 +0100
                Re: pylint, was Re: pygame - importing GL - very bad... Ben Finney <ben+python@benfinney.id.au> - 2013-01-03 17:01 +1100
                Re: pylint, was Re: pygame - importing GL - very bad... Chris Rebert <clp2@rebertia.com> - 2013-01-02 22:33 -0800
                Re: pylint, was Re: pygame - importing GL - very bad... Peter Otten <__peter__@web.de> - 2013-01-03 10:00 +0100
                Re: pylint, was Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-03 12:21 +0100
                Regular expression syntax, was Re: pylint, was Re: pygame - importing GL - very bad... Peter Otten <__peter__@web.de> - 2013-01-03 12:39 +0100
                Re: Regular expression syntax, was Re: pylint, was Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-05 02:12 +0100
                Re: pylint, was Re: pygame - importing GL - very bad... "Mike C. Fletcher" <mcfletch@vrplumber.com> - 2013-01-03 09:19 -0500
                Re: pylint, was Re: pygame - importing GL - very bad... Terry Reedy <tjreedy@udel.edu> - 2013-01-03 11:52 -0500
                Re: pylint, was Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-05 02:14 +0100
            Re: pylint, was Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-03 03:06 +0100
      Re: pylint, was Re: pygame - importing GL - very bad... Chris Angelico <rosuav@gmail.com> - 2013-01-03 01:32 +1100
      Re: pylint, was Re: pygame - importing GL - very bad... Ian Kelly <ian.g.kelly@gmail.com> - 2013-01-02 10:52 -0700
      Re: pylint, was Re: pygame - importing GL - very bad... Chris Angelico <rosuav@gmail.com> - 2013-01-03 04:57 +1100
      Re: pylint, was Re: pygame - importing GL - very bad... Ian Kelly <ian.g.kelly@gmail.com> - 2013-01-02 12:31 -0700
        Re: pylint, was Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-03 03:31 +0100
          Re: pylint, was Re: pygame - importing GL - very bad... Dave Angel <d@davea.name> - 2013-01-02 21:56 -0500
            Re: pylint, was Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-05 02:23 +0100
  Re: pygame - importing GL - very bad... alex23 <wuwei23@gmail.com> - 2013-01-01 14:39 -0800
    Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-02 00:56 +0100

csiph-web