exec and locals

Chris Angelico rosuav at gmail.com
Thu Feb 27 06:05:18 CET 2014


On Thu, Feb 27, 2014 at 3:47 PM, Steven D'Aprano <steve at pearwood.info> wrote:
> Guys, I know that exec is kinda dangerous and newbies should be
> discouraged from throwing every string they see at it, but this isn't my
> second day Python programming, and it's not an accident that Python
> supports the dynamic compilation and execution of source code at runtime.
> It's a deliberate language feature. We're allowed to use it :-)

Code smell means "look at this". It doesn't mean "don't use this
feature ever". :) Steven's looked into this thoroughly, I'm sure, and
exec is important.

ChrisA



More information about the Python-list mailing list