hash consing

John S. Yates, Jr. john at yates-sheets.org
Sat Oct 27 07:37:29 EDT 2001


Is it possible to implement an "immutable" python
class that maintains a single instance of each unique
value via hash consing?  I know that I can maintain
the hash table outside of the class, lookup the
argument tuple for the class instance I want and only
call the constructor when I the lookup fails.  What
I would really like is to be able to hide that logic
inside the constructor.

/john

--
John Yates
40 Pine Street
Needham, MA 02492
781 444-2899



More information about the Python-list mailing list