properties vs. eval()

Jason Mobarak jason.mobarak at gmail.com
Sat May 7 23:50:54 EDT 2005


Bob  Rogers wrote:
> So you're saying you don't know the answer?  The question wasn't
> "should I use setattr?"

If what you're doing is wrong and backwards then it doesn't matter what
the question is. Best practices are best practices for a reason.
There's no reason to use eval to do what you want. The constructs
eval/exec/compile all have their purposes (for example: a remote python
shell) but they weren't intended to be broken replacements for setattr.




More information about the Python-list mailing list