[PyOpenGL-Users] best/good method for namespace pollution avoidance?
Brought to you by:
mcfletch
|
From: Maciej K. <ma...@dg...> - 2003-07-08 21:58:45
|
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.
In view of this I looked at alternatives. Thought of two. Either
from OpenGL.GL import glBegin, glVertex3f, glEnd, GL_LINES
# ... and whatever else is used in module
or
import OpenGL.GL as GL
GL.glBegin(GL.GL_LINES)
GL.glVertex3f(0,0,0)
GL.glVertex3f(1,1,1)
GL.glEnd()
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.
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? :)
--
Maciej Kalisiak|mac@] "It's a shallow life that doesn't give a person a few
dgp.toronto.edu|www.] scars." -- Garrison Keillor
dgp.toronto.edu/~mac]
|