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


Groups > comp.lang.python > #9507

Re: None versus MISSING sentinel -- request for design feedback

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'value,': 0.04; 'default.': 0.09; 'none:': 0.09; 'return,': 0.09; 'subject:None': 0.09; 'there?': 0.09; 'received:209.85.214.174': 0.13; 'received:mail- iw0-f174.google.com': 0.13; 'wrote:': 0.15; '"here\'s': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:design': 0.16; 'subject:versus': 0.16; 'pm,': 0.16; 'possibly': 0.16; '(which': 0.20; "doesn't": 0.22; 'header:In- Reply-To:1': 0.22; 'assume': 0.23; 'code': 0.24; 'subject: -- ': 0.25; 'expect': 0.25; 'function': 0.26; 'work.': 0.28; 'fri,': 0.28; 'guess': 0.28; 'received:209.85.214': 0.28; 'message- id:@mail.gmail.com': 0.28; "didn't": 0.29; "it'd": 0.30; 'values,': 0.30; 'required.': 0.31; 'values': 0.31; 'chris': 0.32; 'too': 0.32; 'to:addr:python-list': 0.34; 'there': 0.34; 'none': 0.35; 'explicit': 0.35; 'question': 0.35; 'some': 0.37; 'but': 0.37; 'using': 0.37; 'received:google.com': 0.38; 'received:209.85': 0.38; 'user': 0.38; 'subject:: ': 0.38; 'steven': 0.38; 'should': 0.39; 'data': 0.39; 'returned': 0.39; 'to:addr:python.org': 0.39; 'missing': 0.40; 'received:209': 0.40; 'agreed': 0.40; 'table': 0.40; 'dedicated': 0.62; 'concept': 0.73; 'favour': 0.73; '"spam"': 0.84; 'mistakenly': 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=WCY1IZP2oP1Mwe1mool+g/c4XMZSU3aD2loMRIJQQ/I=; b=mL8H5MYuFA17PfaIPPyMr0BqXYyclNEMRzi1uKpJRePBeZZKrchppVYKFKRpibJUPF 5GOQmTBjmfijbnt9vLh2A47a0rzQp8qXBVD3BH8jx0ailCj9o8qEmVwUzgKzy8a8qZs2 I8lDXlXhxIxw4LgaUBUqdYq5cT4/nUguocS/o=
MIME-Version 1.0
In-Reply-To <4e1fd009$0$29986$c3e8da3$5496439d@news.astraweb.com>
References <4e1fd009$0$29986$c3e8da3$5496439d@news.astraweb.com>
Date Fri, 15 Jul 2011 16:08:41 +1000
Subject Re: None versus MISSING sentinel -- request for design feedback
From Chris Angelico <rosuav@gmail.com>
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 <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.1044.1310710125.1164.python-list@python.org> (permalink)
Lines 24
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1310710125 news.xs4all.nl 23896 [2001:888:2000:d::a6]:45538
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:9507

Show key headers only | View raw


On Fri, Jul 15, 2011 at 3:28 PM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
> My question is, should I accept None as the missing value, or a dedicated
> singleton?
>
> In favour of None: it's already there, no extra code required. People may
> expect it to work.
>
> Against None: it's too easy to mistakenly add None to a data set by mistake,
> because functions return None by default.

I guess the question is: Why are the missing values there? If they're
there because some function returned None because it didn't have a
value to return, and therefore it's a missing value, then using None
as "missing" would make a lot of sense. But if it's a more explicit
concept of "here's a table of values, and the user said that this one
doesn't exist", it'd be better to have an explicit MISSING. (Which I
assume would be exposed as yourmodule.MISSING or something.)

Agreed that float('nan') and "" and "spam" are all bad values for
Missings. Possibly "" should come out as 0, but "spam" should
definitely fail.

Chris Angelico

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


Thread

None versus MISSING sentinel -- request for design feedback Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-15 15:28 +1000
  Re: None versus MISSING sentinel -- request for design feedback Chris Angelico <rosuav@gmail.com> - 2011-07-15 16:08 +1000
    Re: None versus MISSING sentinel -- request for design feedback "bruno.desthuilliers@gmail.com" <bruno.desthuilliers@gmail.com> - 2011-07-15 00:53 -0700
    Re: None versus MISSING sentinel -- request for design feedback Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-15 20:46 +1000
      Re: None versus MISSING sentinel -- request for design feedback Chris Angelico <rosuav@gmail.com> - 2011-07-15 21:04 +1000
        Re: None versus MISSING sentinel -- request for design feedback Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-15 22:48 +1000
          Re: None versus MISSING sentinel -- request for design feedback Mel <mwilson@the-wire.com> - 2011-07-15 09:16 -0400
            Re: None versus MISSING sentinel -- request for design feedback Ethan Furman <ethan@stoneleaf.us> - 2011-07-15 10:18 -0700
              Re: None versus MISSING sentinel -- request for design feedback Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-07-16 14:24 +1200
                Re: None versus MISSING sentinel -- request for design feedback Ethan Furman <ethan@stoneleaf.us> - 2011-07-16 17:31 -0700
  Re: None versus MISSING sentinel -- request for design feedback Rob Williscroft <rtw@rtw.me.uk> - 2011-07-15 07:43 +0000
    Re: None versus MISSING sentinel -- request for design feedback Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-15 20:19 +1000
      Re: None versus MISSING sentinel -- request for design feedback "OKB (not okblacke)" <brenNOSPAMbarn@NObrenSPAMbarn.net> - 2011-07-15 17:40 +0000
      Re: None versus MISSING sentinel -- request for design feedback Terry Reedy <tjreedy@udel.edu> - 2011-07-15 17:35 -0400
  Re: None versus MISSING sentinel -- request for design feedback Cameron Simpson <cs@zip.com.au> - 2011-07-15 17:44 +1000
    Re: None versus MISSING sentinel -- request for design feedback "bruno.desthuilliers@gmail.com" <bruno.desthuilliers@gmail.com> - 2011-07-15 02:58 -0700
    Re: None versus MISSING sentinel -- request for design feedback Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-15 20:17 +1000
      Re: None versus MISSING sentinel -- request for design feedback Cameron Simpson <cs@zip.com.au> - 2011-07-15 20:38 +1000
  Re: None versus MISSING sentinel -- request for design feedback "bruno.desthuilliers@gmail.com" <bruno.desthuilliers@gmail.com> - 2011-07-15 00:59 -0700
  Re: None versus MISSING sentinel -- request for design feedback Teemu Likonen <tlikonen@iki.fi> - 2011-07-15 11:28 +0300
    Re: None versus MISSING sentinel -- request for design feedback "bruno.desthuilliers@gmail.com" <bruno.desthuilliers@gmail.com> - 2011-07-15 03:02 -0700
      Re: None versus MISSING sentinel -- request for design feedback Teemu Likonen <tlikonen@iki.fi> - 2011-07-15 13:56 +0300
  Re: None versus MISSING sentinel -- request for design feedback Eric Snow <ericsnowcurrently@gmail.com> - 2011-07-15 11:02 -0600

csiph-web