On 8 feb, 05:51, Paul Rubin <http://[EMAIL PROTECTED]> wrote: > "Gabriel Genellina" <[EMAIL PROTECTED]> writes: > > > obj.getattr(a)() > > > but even that is a bit ugly, depending. > > Surely you meant to say getattr(obj, a)() > > Yeah, darn. Counterintuitive. I keep making that error in my own > code too. Maybe I should put in an RFE.
The "method" way is using __getattribute__ or __getattr__. A generic function helps on using it on objects of any kind - like len() Perhaps it was more important with old style classes. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list