Gregor Horvath wrote:

Thank's, but this does not work for this case:

class A(object):
    test = "test"

class B(object):
    a = [A(),]

In [70]: reduce(getattr, "a[0].test".split("."), B)
---------------------------------------------------------------------------
<type 'exceptions.AttributeError'>        Traceback (most recent call last)

getattr fetches a named attribute, it doesn't evaluate random code snippets. please read the manual.

</F>

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

Reply via email to