mshiltonj wrote:
> In python, I'm doing something like this:
> 
>  def three_fields(self, field1, field2, field3):
>       for field in (field1, field2, field3):
>             value = eval('self.' + field) # this is the one I'm
> interested in
>             [...]
> 
> This seems to do what I expect it to do. I'm wondering if that's the
> preferred or standard way to do this in python. I wasn't sure how to
> tease the answer to this question out of Google.

        I believe you are looking for the getattr function.

-- 
--OKB (not okblacke)
Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is
no path, and leave a trail."
        --author unknown
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to