Can I run an operation on an object's attribute when reading?
Ben Finney
bignose+hates-spam at benfinney.id.au
Mon Jan 19 07:38:51 EST 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_ |
Ben Finney
More information about the Python-list
mailing list