#include equivalent

Michael Hudson mwh21 at cam.ac.uk
Tue Apr 3 04:06:44 EDT 2001


kragen at dnaco.net (Kragen Sitaker) writes:

> Yeah, but there are problems with execfile():
> - it puts all the stuff in that file in *your* namespace (not a separate one)
> - circular execfile()s will hang your program and eventually crash
...
> - execfile()ing the same file from two different modules generates two
...
>   - It takes more time (potentially *much* more time) 
>   - it takes more space (potentially *much* more space)
>   - it breaks objects that try to determine whether other objects are
...
>   - and it breaks any modules that try to maintain module state (like
...

So much more like #include then!

> So don't use execfile() instead of import.

Well, no, but that not really what was being proposed, was it?
Someone asked for an #include equivalent, and while import is probably
want they wanted, execfile is closer.  Different things.

Cheers,
M.

-- 
  I'm not particularly fond of singing GSTQ because she stands for
  some things I don't, but it's not really worth letting politics
  getting in the way of a good bawling.
                                            -- Dan Sheppard, ucam.chat



More information about the Python-list mailing list