Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #59172
| References | <CAB6+5b_w+kBT=EDqd9wRO80am+Wp2DgrEqSpVEPWkcTAVmYQtQ@mail.gmail.com> <1384206048.30461.46091021.634F0FCA@webmail.messagingengine.com> |
|---|---|
| Date | 2013-11-12 10:39 +0100 |
| Subject | Re: 'isimmutable' and 'ImmutableNester' |
| From | Frank-Rene Schäfer <fschaef@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2445.1384249197.18130.python-list@python.org> (permalink) |
> 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?
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: 'isimmutable' and 'ImmutableNester' Frank-Rene Schäfer <fschaef@gmail.com> - 2013-11-12 10:39 +0100
csiph-web