scalar references
Erik Max Francis
max at alcyone.com
Wed Nov 19 00:10:55 EST 2003
John Hunter wrote:
> My current approach (which works) is
>
> class RRef:
> 'A read only ref'
> def __init__(self, val):
> self._val = val
>
> def get(self):
> return self._val
>
> class RWRef(RRef):
> 'A readable and writable ref'
> def set(self, val):
> self._val = val
Yep, this is the kind of thing I usually do. If you'd like to write
shorter, but less self-documenting code, you can just use a one-element
list.
--
Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
__ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
/ \
\__/ Perfect situations must go wrong
-- Florence, _Chess_
More information about the Python-list
mailing list