Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #59172

Re: 'isimmutable' and 'ImmutableNester'

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <fschaef@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.022
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; "subject:' ": 0.07; 'insertion': 0.09; 'cc:addr:python-list': 0.11; 'behave': 0.16; 'members)': 0.16; 'mutable': 0.16; 'objects.': 0.16; 'overriding': 0.16; 'things.': 0.19; 'cc:addr:python.org': 0.22; 'string,': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'header:In- Reply-To:1': 0.27; 'function': 0.29; 'on,': 0.29; 'sets': 0.30; 'message-id:@mail.gmail.com': 0.30; "skip:' 10": 0.31; 'accomplished': 0.31; 'concern': 0.31; 'int,': 0.31; 'tuples': 0.31; 'class': 0.32; '(including': 0.33; 'not.': 0.33; 'could': 0.34; 'received:google.com': 0.35; 'done': 0.36; 'itself': 0.39; 'tell': 0.60; 'from:charset:utf-8': 0.61; "you've": 0.63; 'benefit': 0.68; 'special': 0.74
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=q4aO5Glst+qCIxFSbA7mm6rmgiefJ+a1gkRI+e/JM1A=; b=ID0BA1nou43qLTGEsp1tZmRSjuUpc2xKhLgxp2kzVoVcDAulalUeYExqJJAs2FfE6Z /EOcNzIz7eVcJmKqD8+MFlFos1gY8lAr/R1hQDG8VSDPisyK7mAwtz1gmr0k7HOPKzpE eCu4OBtC7Es7HVR9+ABx//QqUqYHfihze3HSgaojQaBcxj0LUHBIVgUCOu+rxkO7H4uW I1gJiUWsrORvaK0olqxjneqTeUX8Pa8PNkWbGzAwyPwe/gBgBhw4Gl4M9/G/fHSa7wiS 5q0SbC3OKll3sLkI6//7BuqNYC7EAWBHNp9QwHzVlRWUUdSWaZEwiLZYto37Xnd5cH3j qQsA==
MIME-Version 1.0
X-Received by 10.224.127.193 with SMTP id h1mr57219905qas.82.1384249189157; Tue, 12 Nov 2013 01:39:49 -0800 (PST)
In-Reply-To <1384206048.30461.46091021.634F0FCA@webmail.messagingengine.com>
References <CAB6+5b_w+kBT=EDqd9wRO80am+Wp2DgrEqSpVEPWkcTAVmYQtQ@mail.gmail.com> <1384206048.30461.46091021.634F0FCA@webmail.messagingengine.com>
Date Tue, 12 Nov 2013 10:39:49 +0100
Subject Re: 'isimmutable' and 'ImmutableNester'
From Frank-Rene Schäfer <fschaef@gmail.com>
To random832@fastmail.us
Content-Type text/plain; charset=UTF-8
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2445.1384249197.18130.python-list@python.org> (permalink)
Lines 19
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1384249197 news.xs4all.nl 15887 [2001:888:2000:d::a6]:58433
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:59172

Show key headers only | View raw


> 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


Thread

Re: 'isimmutable' and 'ImmutableNester' Frank-Rene Schäfer <fschaef@gmail.com> - 2013-11-12 10:39 +0100

csiph-web