function namespaces

Steve Holden steve at
Wed Mar 9 02:30:00 CET 2005

Darren Dale wrote:
>>Generally, I avoid execfile within a function.  What's your use case?
>>There may be a better way to approach this problem...
> I am writing a simulation that loads some predefined constants, depending on
> the options called by the user. I originally had it set up to parse the
> file, and load the constants explicitly, but then I thought that with the
> existence of this handy builtin execfile, I could make write my constants
> file in python, and just load it. I guess it is not the best approach.
> Thanks for the advice though (everyone), I learned something.

Think about using the dreaded (and dangerous, but in your case 
potentially extremely useful)

   from config import *


More information about the Python-list mailing list