How to make an immutable instance

Michael Hudson mwh at
Fri Jun 18 12:36:38 CEST 2004

"Batista, Facundo" <FBatista at> writes:

> I'm working on Decimal, and one of the PEP requests is Decimal to be
> immutable.


> So, if you use this "immutable" class in a dict, and then you (on purpose)
> modify it, you'll have different hashes.
> Said that, how safer is this approach? Is there a better way?

I'd say it's safe enough.  It's going to be impossible to guard
against all malicious code, so you should aim to prevent accidents.


  I also feel it essential to note, [...], that Description Logics,
  non-Monotonic Logics, Default Logics and Circumscription Logics 
  can all collectively go suck a cow. Thank you.

More information about the Python-list mailing list