Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!newsreader4.netcologne.de!news.netcologne.de!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!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.028 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; "subject:' ": 0.07; 'received:internal': 0.09; 'members)': 0.16; 'message- id:@webmail.messagingengine.com': 0.16; 'mutable': 0.16; 'overriding': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:messagingengine.com': 0.16; 'string,': 0.24; 'header:In- Reply-To:1': 0.27; 'to:2**1': 0.27; 'function': 0.29; "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:66': 0.35; 'received:10': 0.37; 'to:addr :python-list': 0.38; 'itself': 0.39; 'to:addr:python.org': 0.39; 'tell': 0.60; 'from:no real name:2**0': 0.61; 'header:Message- Id:1': 0.63; 'to:addr:gmail.com': 0.65; 'benefit': 0.68; 'special': 0.74 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.us; h= message-id:from:to:mime-version:content-transfer-encoding :content-type:in-reply-to:references:subject:date; s=mesmtp; bh= 7ktuCKV9qgtx0iyrgF/yIaEo22E=; b=pGsiLZitjZI/ZsUv2rOAQbq8Lj0h70qd fqVsaGE/1KW9xDpOjATWLNBxIq45Aj2OW53GIjzONgjS0F5wtYg1pV0N1/Vxkbgs t/20Sc84NIzeLkHDqFC/uS8UrJ8vKtiOxilaZ62BCTHmSn+kgtWwLjO8VLbr3MW+ r036Bik6jkw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=message-id:from:to:mime-version :content-transfer-encoding:content-type:in-reply-to:references :subject:date; s=smtpout; bh=7ktuCKV9qgtx0iyrgF/yIaEo22E=; b=TT5 +sHj5ewQ3nFfZhSFsnGBSMJKRn6b+2tCWcXEB7m+kv2y42UYPZdfmnQ/8xChfarE rwgUQD6gfr8kwPk4Srzm63qO7+raU3hP0RV1QozUA6J8+k531qYwgqTmbI793TPp GE/GZJ6x/QmJmJQe0IPbNd6AiN0eqehU3iCDXk5g= X-Sasl-Enc: Ej5hItup1rCYzAiXdxeM291yAKhie+DZ1ZIQqQpGl05E 1384206048 From: random832@fastmail.us To: =?UTF-8?Q?Frank-Rene=20Sch=C3=A4fer?= , python-list@python.org MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain X-Mailer: MessagingEngine.com Webmail Interface - ajax-d4893488 In-Reply-To: References: Subject: Re: 'isimmutable' and 'ImmutableNester' Date: Mon, 11 Nov 2013 16:40:48 -0500 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: 10 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1384206051 news.xs4all.nl 15972 [2001:888:2000:d::a6]:58508 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:59102 > 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?