unittest: Dynamically creating tests

Peter Hansen peter at engcorp.com
Wed Jun 11 17:25:10 EDT 2003


Michele Simionato wrote:
> 
> Steven Taschuk <staschuk at telusplanet.net> wrote in message news:<mailman.1055356374.23599.python-list at python.org>...
> >
> > There's also
> >     globals()['foo'] = 'bar'
> > and, of course, exec.
> >
> 
> I seems to remember (from reading the standard library)
> that assigning directly to globals() is not recommended; am
> I correct ? What can go wrong with this?

Are you misremembering the part about assigning to locals()
being very bad?  I thought assigning to globals() was fine 
technically, whether there were stylistic concerns or not.

-Peter




More information about the Python-list mailing list