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: 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: References: <1384206048.30461.46091021.634F0FCA@webmail.messagingengine.com> Date: Tue, 12 Nov 2013 20:44:37 +1100 Subject: Re: 'isimmutable' and 'ImmutableNester' From: Chris Angelico 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 On Tue, Nov 12, 2013 at 8:39 PM, Frank-Rene Sch=E4fer w= rote: >> 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 obje= cts. 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