Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:not': 0.03; 'plenty': 0.07; "subject:' ": 0.07; 'string': 0.09; 'obj': 0.09; 'subject:None': 0.09; 'subject:Why': 0.09; 'subject:string': 0.09; "wouldn't": 0.14; 'piotr': 0.16; 'received:192.168.0.11': 0.16; 'unbound': 0.16; 'wrote:': 0.18; 'instance,': 0.24; 'subject: : ': 0.26; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'correct': 0.29; 'am,': 0.29; 'characters': 0.30; 'request,': 0.31; 'prepare': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'sequence': 0.36; 'charset:us-ascii': 0.36; 'subject:?': 0.36; 'sometimes': 0.38; 'message-id:@gmail.com': 0.38; 'to:addr:python- list': 0.38; 'does': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'problems.': 0.60; 'header:Message-Id:1': 0.63; 'field': 0.63; 'more': 0.64; 'subjectcharset:iso-8859-1': 0.66; 'containing': 0.69 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to; bh=g9G4enZ/BIondAv0KNPYKfPRadWGMkbS44QkhIn4oCI=; b=efDDRFJdYAALAbYgM0X5XMq1GfBTBN0vn2/Igaz1tzHa1m6rfbjqOq71/7X8H4AB+A rJtTZK7bosqdj+0nGDtU3wUPk1BCUYvdSq7UTJ5Cxjqah08cg3SDb31AptRdsI7AvwDK 6h3Qr+N/F+e4I7ODRp31+LQbtiL03BWf3R9viBk4uiSPQ3r5xwEAHg/IBl0yfy5HO/Tu eSXelmQcXP3JF8fHn5VWkI2p55ra0/d/wzn7+WaL9sKnyHbPpv876W+3mdEOzjfMAByC CouNf7ssSpBDLeWCldpRyjfgdqg3d/KRM/ccT0PNFS3tPXgazsPNsK90LBfWpS6ec0no uyAA== X-Received: by 10.194.19.228 with SMTP id i4mr714571wje.87.1377690179609; Wed, 28 Aug 2013 04:42:59 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.5 \(1508\)) Subject: =?iso-8859-1?Q?R=E9p_=3A_Why_is_str=28None=29_=3D=3D_=27None=27_?= =?iso-8859-1?Q?and_not_an_empty_string=3F?= From: Fabrice POMBET In-Reply-To: Date: Wed, 28 Aug 2013 13:42:57 +0200 Content-Transfer-Encoding: quoted-printable References: To: python-list@python.org X-Mailer: Apple Mail (2.1508) X-Mailman-Approved-At: Wed, 28 Aug 2013 13:44:31 +0200 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: 19 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1377690272 news.xs4all.nl 15977 [2001:888:2000:d::a6]:51573 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:53134 On 8/28/2013 4:57 AM, Piotr Dobrogost wrote: > Having repr(None) =3D=3D 'None' is sure the right thing but why does = str(None) =3D=3D 'None'? Wouldn't it be more correct if it was an empty = string? the point of str(obj) is to return a string containing the obj (a = sequence of characters if it is unbound or not built-in, etc.)... If you set the rule str(None)=3D=3D"", then you will cause plenty of = problems.=20 For instance, if you want to build a string like request=3D"SELECT = X"+"IN Y"+"WHERE B=3D"+String(B) to prepare a sequel request, and the field B happens to be sometimes = "None", you would automatically end up with """SELECT X IN Y WHERE = B=3D''""" instead of """SELECT X IN Y WHERE B=3D'None'""", and your sql request will fall into limbos...=