Back to SDS/2 Parametric Scripts

 
## Case insensitive search for class attribute or method
>>> s = 'NaMe'
>>> def lower_name(s, obj):
...    for item in dir(obj):
...           if item.lower() == s.lower():
...                 return item
...           
>>> lower_name(s, d2)
'name'
>>> getattr(d2.__class__, lower_name(s, d2))
'Plane3D'
>>> d2.name
'Plane3D'
>>>