How to make an immutable instance
Michael Hudson
mwh at python.net
Fri Jun 18 06:36:38 EDT 2004
"Batista, Facundo" <FBatista at uniFON.com.ar> 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.
Cheers,
mwh
--
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.
-- http://advogato.org/person/Johnath/diary.html?start=4
More information about the Python-list
mailing list