How to customize getattr(obj, prop) function ?

Pierre meyer.p at gmail.com
Thu May 18 05:24:27 EDT 2006


I don't want to use getattr(object, property, default_value) because
I'm using external code and I don't want to modify or patch it. In this
code, the call is getattr(object, property).

On my objects, I must provide default values depending on the property
that was requested, the default value is not always the same.

And Yes I understand that obj.a is equivalent to getattr(obj, 'a') BUT
the difference between class attribute and instance attribute... :S




More information about the Python-list mailing list