eval [was Re: dict to boolean expression, how to?]
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Tue Aug 5 12:25:29 EDT 2014
Duncan Booth wrote:
> Steven D'Aprano <steve+comp.lang.python at pearwood.info> wrote:
[...]
>> My refactoring, with the bare minimum use of exec necessary:
>>
>> https://code.activestate.com/recipes/578918-yet-another-namedtuple/
>
>
> This may be a silly question, but what would stop you moving the exec
> inside the class?
I don't know. I haven't tried it. I didn't think of it at the time.
I don't have any specific arguments either against or in favour of your
suggestions, except to say that exec is sometimes tricky to get working
unless you explicitly specify the namespace to operate in.
--
Steven
More information about the Python-list
mailing list