Can I run an operation on an object's attribute when reading?
bignose+hates-spam at benfinney.id.au
Mon Jan 19 13:38:51 CET 2009
Ben Finney <bignose+hates-spam at benfinney.id.au> writes:
> You can override the behaviour of a class by defining a subclass.
> class UntouchableTypeWrapper(UntouchableType):
> def _foo_get(self):
> return str(self.foo)
> foo = property(_foo_get)
Which, I realise now, won't work (and I didn't test it). But hopefully
the idea is clear.
\ “Pinky, are you pondering what I'm pondering?” “I think so, |
`\ Brain, but if we have nothing to fear but fear itself, why does |
_o__) Elanore Roosevelt wear that spooky mask?” —_Pinky and The Brain_ |
More information about the Python-list