Do Re Mi chel La Si Do wrote:
Also :
    classname = "Dog"
    exec("b="+classname+"()")
    b.bark()

or
    classname = "Dog"
    exec("cl="+classname)
    b=cl()
    b.bark()

Ugh.

The statement exec (note: it's a statement, not a
function call as you imply with the above) is rarely
either required or good style.

In this case it's neither.

-Peter
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to