[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-list
Subject:    Re: 'isimmutable' and 'ImmutableNester'
From:       Frank-Rene_Schäfer <fschaef () gmail ! com>
Date:       2013-11-12 9:39:49
Message-ID: CAB6+5b-V1VkgZPwjwZHiGmxUU9ZWgBE7Cgo4k9eg7GKSaNjw6g () mail ! gmail ! com
[Download RAW message or body]

> All you've done is proven that you can subvert things. By fiddling
> with __hash__, __eq__, and so on, you can make sets and dicts behave
> very oddly. Means nothing.

To the contrary, it means everything about what 'isimmutable' could
contribute: security against advert or inadvert insertion of mutable objects.


2013/11/11  <random832@fastmail.us>:
>> A built-in function 'isimmutable()' shall tell efficiently whether the
>> object
>> of concern is mutable or not.
>
> What's the benefit over attempting to hash() the object?
>
> copy.deepcopy already has special case for int, string, and tuples
> (including tuples that do and do not have mutable members) - could what
> you need be accomplished by overriding __copy__ and __deepcopy__ in your
> custom class to return itself if it is immutable?
-- 
https://mail.python.org/mailman/listinfo/python-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic