idiom for constructor?

Volker Grabsch volker_grabsch at v.notjusthosting.com
Sat Jun 4 14:19:30 EDT 2005


Peter Dembinski wrote:
>> This is not a good use case for exec.  Use setattr:
> 
> OK, true.
> From the other side: what are the usual uses of 'exec'?

An interactive Python interpreter. :-)

No, seriously: Introspection is always better than exec.
It is far less error phrone, especially because you don't need
to deal with quoting issues, and because you have an initial
syntax check of your Python code which is bypassed when using exec.

Similarly, try to avoid system() whenever possible.


Greets,

-- 
Volker Grabsch
---<<(())>>---
\frac{\left|\vartheta_0\times\{\ell,\kappa\in\Re\}\right|}{\sqrt
[G]{-\Gamma(\alpha)\cdot\mathcal{B}^{\left[\oint\!c_\hbar\right]}}}



More information about the Python-list mailing list