Differences between obj.attribute and getattr(obj, "attribute")

Johannes Schneider johannes.schneider at galileo-press.de
Wed Dec 11 03:23:29 EST 2013


Hi list,
can somebody explain me the difference between accessing attributes via
obj.attribute and getattr(obj, "attribute")?

Is there a special reason or advantage when using getattr?

bg,
Johannes

-- 
Johannes Schneider
Webentwicklung
johannes.schneider at galileo-press.de
Tel.: +49.228.42150.xxx

Galileo Press GmbH
Rheinwerkallee 4 - 53227 Bonn - Germany
Tel.: +49.228.42.150.0 (Zentrale) .77 (Fax)
http://www.galileo-press.de/

Geschäftsführer: Tomas Wehren, Ralf Kaulisch, Rainer Kaltenecker
HRB 8363 Amtsgericht Bonn




More information about the Python-list mailing list