Re: [PyOpenGL-Users] best/good method for namespace pollution avoidance?
Brought to you by:
mcfletch
|
From: Mike C. F. <mcf...@ro...> - 2003-07-09 10:25:39
|
Maciej Kalisiak wrote:
>Hello all,
>
>For the longest time I've been using the following method to import
>OpenGL functions and constants:
>
> from OpenGL.GL import *
>
>After starting to use pydoc to make documentation of my code, I came to
>realize how badly this pollutes the namespace (and makes huge HTML
>files). I'm also recently concerned that this is seriously slowing down
>my app's startup time on old HW.
>
To avoid this, see the OpenGLContext package's subclass of pydoc which
allow for filtering out names imported from other modules.
>In view of this I looked at alternatives. Thought of two. Either
>
>
...
>I'm unhappy with both methods. Method 1 makes for long import lines,
>and you end up invariably running into unimported names as they get used
>in the code. The second method is also error-prone, as it is quite easy
>to forget the prefix each time you add a block of OpenGL code.
>
I can't see doing either in regular rendering code, really. I've used
both in situations where there's only a few functions, but it's really
awkward. The wxPython peoples have recently gone through the process of
renaming everything from:
wxBlah to wx.Blah
but that would make PyOpenGL code require rewriting C code for
*everything*, while today you can often just copy the code directly and
have it run. Not a real option in my books. (At one time IIRC we did
have that naming and just gave up on it as too awkward).
>Surely this is an old problem, and someone on the list can deliver me
>from my misery by showing me the "one, true, perfect" method, no? :)
>
Perfect solutions are few and far between, but searching for them is
still a noble goal. Good luck,
Mike
PS: PyGTA meets on the 4th Tuesday of the month ;)
_______________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder
http://members.rogers.com/mcfletch/
|