Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!news-transit.tcx.org.uk!newsfeed.xs4all.nl!newsfeed5.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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python,': 0.01; 'memory.': 0.05; 'default:': 0.09; 'of)': 0.09; 'value:': 0.09; 'am,': 0.12; 'def': 0.13; 'received:209.85.210.174': 0.13; 'received:mail- iy0-f174.google.com': 0.13; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'singleton': 0.16; 'subject:() ': 0.16; 'subject:function': 0.16; 'wrote:': 0.18; 'header:In- Reply-To:1': 0.22; 'testing': 0.26; 'function': 0.27; 'message- id:@mail.gmail.com': 0.28; '27,': 0.29; 'nov': 0.29; 'sun,': 0.30; 'objects': 0.32; 'to:addr:python-list': 0.34; 'languages': 0.35; 'comparing': 0.37; 'two': 0.37; 'but': 0.37; 'received:google.com': 0.37; 'received:209.85': 0.38; 'received:209': 0.40; 'to:addr:python.org': 0.40; '2011': 0.61; 'high': 0.67; 'low': 0.74; 'candide': 0.84; 'seldom': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=MtmRz3aAKwWUDEdlXoyjqSWSwBInjlxfWDlBL7IganU=; b=YRVbrNUkntCmggWGiWGTgROlytm4kzjgglHCT4vk5I8Qj95lDvXOmk95P2UdtTl93N 2NANS22tIAxO3yHTOENyyBKMm9jLUb0l29QoX1+wsC51YK/qVeT/zxmT23TY136pK9uP PfBmMbQCDjzT2MpxDyVlxEO1thkQ133p2aQHI= MIME-Version: 1.0 In-Reply-To: <4ed15825$0$21841$426a34cc@news.free.fr> References: <4ed15825$0$21841$426a34cc@news.free.fr> Date: Sun, 27 Nov 2011 09:22:40 +1100 Subject: Re: Pragmatics of the standard is() function From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 15 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1322346163 news.xs4all.nl 6968 [2001:888:2000:d::a6]:34794 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:16265 On Sun, Nov 27, 2011 at 8:20 AM, candide wrote: > is() function makes comparaison of (abstract representation of) adresses of > objects in memory. Comparing addresses of objects is a low level feature > performed by low level langages such as C but seldom needed in high level > languages like Python, isn'it ? You also want 'is' when you're testing for a singleton used as a default value: DEFAULT = object() def foo(arg1,arg2,arg3=DEFAULT): if arg3 is DEFAULT: print("You gave me two args") ChrisA