[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] From * import * and Pygame2exe



On Mon, 18 Jul 2005 12:48 pm, andrew baker wrote:
> > > It was my understanding that using "from" would place those values in
> > > the local namespace, and not increase in size unless I introduce new
> > > variables.
> >
> > Yes, it imports the vars into your local namespace, but the module will
> > also hang around in the sys.modules namespace.
>
> Ah, that makes sense.  I'm a bit annoyed, but I'm sure it's for a good
> reason.

Mostly so that when you "import pygame" in every single module, it doesn't 
import it more than once :)


> > If the module's been compiled, then the module
> > import will be faster (it still has to exec, but the compilation is
> > done). You can mimic this by using the marshal module (which exists to
> > write compiled modules).
>
> That's another thing I was thinking, was generating pyc files and
> exec'ing them. This would also make cheating by looking at the room
> data somewhat less trivial.

Yep, I didn't mention it before, and you might already have seen it, but 
you'll be wanting to look into the "compiler" module.


    Richard

Attachment: pgpKAelWedbLD.pgp
Description: PGP signature