Using isA and getA in a python way

C Gillespie csgcsg39 at hotmail.com
Mon Sep 20 08:31:44 EDT 2004


Dear All,

I have long list of if statements in the form of:

if obj.isA(): return obj.getA()
if obj.isB(): return obj.getB()
if obj.isC(): return obj.getC()
if obj.isD(): return obj.getD()
<snip>

Is there a nicer way of doing this, perhap going through the list
['A','B','C',..

Many thanks

Colin





More information about the Python-list mailing list