On Sat, Apr 17, 2010 at 5:09 PM, Richard Jones <[email protected]> wrote: > On Sun, Apr 18, 2010 at 2:59 AM, Casey Duncan <[email protected]> wrote: >> My understanding was that most of the import trickery was to work >> around circular import problems, but I could be wrong in this case. > > The import trickery is to allow users to "import pyglet" and then > refer to any sub-module with no further imports; but without requiring > that the "pyglet" module actually import all those sub-modules until > they're needed.
Has anyone ever actually used this to their advantage, and shortened startup time significantly in a real program? The only real use case is importing pyglet, processing command line arguments, and then exiting before doing anything with pyglet. As soon as you make a window or a vertex buffer or load an image or etc., you're going to end up paying most of that cost anyway. Aside from that, explicit is better than implicit. Either pyglet should commit to explicitly exposing the (real) pyglet.foo modules, or it should not and application writers should explicitly import what they want to use. Implicit behavior leads to silent and strange bugs such as this one. -- You received this message because you are subscribed to the Google Groups "pyglet-users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/pyglet-users?hl=en.
