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


Groups > comp.lang.python > #59174

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 <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.017
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; "subject:' ": 0.07; 'immutable': 0.09; 'insertion': 0.09; 'behave': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'hashable': 0.16; 'mutable': 0.16; 'objects.': 0.16; 'wrote:': 0.18; 'things.': 0.19; 'not,': 0.20; "aren't": 0.24; 'stick': 0.24; 'header:In-Reply-To:1': 0.27; 'on,': 0.29; 'sets': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; "skip:' 10": 0.31; 'are.': 0.31; 'figure': 0.32; 'could': 0.34; 'something': 0.35; 'objects': 0.35; 'received:google.com': 0.35; 'done': 0.36; 'so,': 0.37; 'nov': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; '12,': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; "you've": 0.63; 'itself?': 0.84; '2013': 0.98
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 :content-type:content-transfer-encoding; bh=MNZ5+wxajfdmwbktt2yHZQVCmSiUPV09SM0XtHVNwng=; b=x/Sd88mQ4v5utpRPFuBZyafRFa096NFa59VXnaA5kWDklGTRIwxwQfwB1VxSnRk1cF GsnKMCxhF5CD8IvBi+Svch8s+A4TUfHvQCNRNq/bIHh6S91nyG77YjiGwPHDUq/4aNtn 9UanMWCIAzBMHPptDYhoETf/t/okIyLBE8v09Nbwb/NZhQign2nayISaHbwCmByLwOKL 2pV7fE6Q9/KSKod9oOaTHdiU2YZiFEyyNI2UvwTGS0PpeYyi/36hfmXql1OYIw7g7Gja QtOdkNWCM29EQ2ZziNVUt6lIfpmU1EDygrncoYSCBzOslxjtwqOPu0aiinWaGK0D1RLh P1cQ==
MIME-Version 1.0
X-Received by 10.68.225.9 with SMTP id rg9mr34937397pbc.122.1384249477921; Tue, 12 Nov 2013 01:44:37 -0800 (PST)
In-Reply-To <CAB6+5b-V1VkgZPwjwZHiGmxUU9ZWgBE7Cgo4k9eg7GKSaNjw6g@mail.gmail.com>
References <CAB6+5b_w+kBT=EDqd9wRO80am+Wp2DgrEqSpVEPWkcTAVmYQtQ@mail.gmail.com> <1384206048.30461.46091021.634F0FCA@webmail.messagingengine.com> <CAB6+5b-V1VkgZPwjwZHiGmxUU9ZWgBE7Cgo4k9eg7GKSaNjw6g@mail.gmail.com>
Date Tue, 12 Nov 2013 20:44:37 +1100
Subject Re: 'isimmutable' and 'ImmutableNester'
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
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.2447.1384249481.18130.python-list@python.org> (permalink)
Lines 17
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1384249481 news.xs4all.nl 16011 [2001:888:2000:d::a6]:35392
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:59174

Show key headers only | View raw


On Tue, Nov 12, 2013 at 8:39 PM, Frank-Rene Schäfer <fschaef@gmail.com> wrote:
>> 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.

So how do you figure out whether something's immutable or not? Are you
going to ask the object itself? If so, stick with __hash__, and just
follow the rule that mutable objects aren't hashable - which is, if
I'm not mistaken, how things already are. And if not, then how? How
will you know if something has mutator methods?

ChrisA

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: 'isimmutable' and 'ImmutableNester' Chris Angelico <rosuav@gmail.com> - 2013-11-12 20:44 +1100

csiph-web