Can I run an operation on an object's attribute when reading?

Bruno Desthuilliers bdesth.quelquechose at free.quelquepart.fr
Mon Jan 19 14:05:59 EST 2009


Steven D'Aprano a écrit :
(snip)

> When all you have is a hammer, everything looks like a nail... Why do you 
> have to read item.tags directly? Just write a function and call it 
> instead of direct attribute access.

A sensible advice, but only relevant if this class instances are only 
used by code the OP do control. Which may or not be the case.




More information about the Python-list mailing list