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


Groups > comp.lang.python > #53124

Re: Why is str(None) == 'None' and not an empty string?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.mixmin.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:not': 0.03; "subject:' ": 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:None': 0.09; 'subject:Why': 0.09; 'subject:string': 0.09; 'jan': 0.12; "wouldn't": 0.14; 'piotr': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'wrote:': 0.18; 'header:User-Agent:1': 0.23; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'correct': 0.29; 'am,': 0.29; 'but': 0.35; 'there': 0.35; 'subject:?': 0.36; 'to:addr:python-list': 0.38; 'does': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'no.': 0.61; 'received:173': 0.61; 'more': 0.64; 'different.': 0.84; 'received:fios.verizon.net': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Terry Reedy <tjreedy@udel.edu>
Subject Re: Why is str(None) == 'None' and not an empty string?
Date Wed, 28 Aug 2013 06:33:04 -0400
References <155b0796-147b-4132-adf0-e73c0e30969a@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host pool-173-75-251-66.phlapa.fios.verizon.net
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8
In-Reply-To <155b0796-147b-4132-adf0-e73c0e30969a@googlegroups.com>
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 <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.300.1377686649.19984.python-list@python.org> (permalink)
Lines 10
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1377686649 news.xs4all.nl 15914 [2001:888:2000:d::a6]:38234
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:53124

Show key headers only | View raw


On 8/28/2013 4:57 AM, Piotr Dobrogost wrote:

> Having repr(None) == 'None' is sure the right thing but why does str(None) == 'None'? Wouldn't it be more correct if it was an empty string?

No.
There is no reason to be different.

-- 
Terry Jan Reedy

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


Thread

Why is str(None) == 'None' and not an empty string? Piotr Dobrogost <p@google-groups-2013.dobrogost.net> - 2013-08-28 01:57 -0700
  Re: Why is str(None) == 'None' and not an empty string? Terry Reedy <tjreedy@udel.edu> - 2013-08-28 06:33 -0400
  Re: Why is str(None) == 'None' and not an empty string? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-28 12:21 +0000
    Re: Why is str(None) == 'None' and not an empty string? Ian Kelly <ian.g.kelly@gmail.com> - 2013-08-29 04:43 -0600
      Re: Why is str(None) == 'None' and not an empty string? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-30 01:57 +0000
        Re: Why is str(None) == 'None' and not an empty string? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-30 02:44 +0000
    Re: Why is str(None) == 'None' and not an empty string? Tim Delaney <timothy.c.delaney@gmail.com> - 2013-08-30 06:59 +1000

csiph-web