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


Groups > comp.lang.python > #83345

Re: Comparisons and sorting of a numeric class....

Path csiph.com!usenet.pasdenom.info!news.etla.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.027
X-Spam-Evidence '*H*': 0.95; '*S*': 0.00; 'python:': 0.09; 'way:': 0.09; 'def': 0.12; 'jan': 0.12; '"and"': 0.16; 'be:': 0.16; 'none.': 0.16; 'opposite': 0.16; 'underlying': 0.16; 'wrote:': 0.18; 'wed,': 0.18; '>>>': 0.22; 'error': 0.23; 'header:In-Reply- To:1': 0.27; 'function': 0.29; 'message-id:@mail.gmail.com': 0.30; "d'aprano": 0.31; 'pascal': 0.31; 'steven': 0.31; 'sense': 0.34; 'skip:d 20': 0.34; "i'd": 0.34; 'received:google.com': 0.35; 'really': 0.36; 'false': 0.36; 'returning': 0.36; 'scheme': 0.36; 'example,': 0.37; 'skip:o 20': 0.38; 'depends': 0.38; 'to:addr :python-list': 0.38; 'pm,': 0.38; 'rather': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'first': 0.61; 'skip:n 10': 0.64; 'other.': 0.75; '2015': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=1ZHAp66dTesiJ7hMVDtb7puqHFztlyY+sJ7f6mCwylA=; b=NaTiBrBgsZKfY0ecgYlegh7HBTI8q03fqnTB+besWRMZgzEhsxxMtUOk8a5/Hy3l66 Zv4yBws//3Z6IjV65flCFYpVPNUHADcx8dEmTyEi7xiEHJvKoj0Bd62UemmJMRejRqqZ QtCVZWdeoL2+POC0h3jxkzvuIXi480R5VAmlx2PbiMo/DFtNA5gEv5ACjtad/DIPmoN6 GmZyrnKNmvIGOeXarEH++/jmJrxjBmave48+7CDYCAxBTDUz58VMdrhgl0kYwu6g6mvj 4dlr6pSyyjkF0YqyCgMcKt4doNnoSz+CUV/m9URZ7fACxsVe0POw9KphPBloZOjtMvqj +zNw==
X-Received by 10.68.222.130 with SMTP id qm2mr15872545pbc.44.1420729083952; Thu, 08 Jan 2015 06:58:03 -0800 (PST)
MIME-Version 1.0
In-Reply-To <877fwx3i8f.fsf@elektro.pacujo.net>
References <54ABB88A.7070504@r3dsolutions.com> <54ABC52A.1050507@davea.name> <54ABE383.3020801@r3dsolutions.com> <54ABEAD9.8070000@davea.name> <mailman.17424.1420596200.18130.python-list@python.org> <54ace9f0$0$2738$c3e8da3$76491128@news.astraweb.com> <87tx02gb9d.fsf@elektro.pacujo.net> <54adc53c$0$12999$c3e8da3$5496439d@news.astraweb.com> <877fwx3i8f.fsf@elektro.pacujo.net>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Thu, 8 Jan 2015 07:57:23 -0700
Subject Re: Comparisons and sorting of a numeric class....
To Python <python-list@python.org>
Content-Type text/plain; charset=UTF-8
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 <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.17478.1420729591.18130.python-list@python.org> (permalink)
Lines 42
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1420729591 news.xs4all.nl 2887 [2001:888:2000:d::a6]:51601
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:83345

Show key headers only | View raw


On Wed, Jan 7, 2015 at 11:21 PM, Marko Rauhamaa <marko@pacujo.net> wrote:
> Steven D'Aprano <steve+comp.lang.python@pearwood.info>:
>
>> Marko Rauhamaa wrote:
>>> I prefer the Scheme way:
>>>    #f is a falsey object
>>>    everything else is a truthy object
>>
>> The Scheme way has no underlying model of what truthiness represents, just
>> an arbitrary choice to make a single value have one truthiness, and
>> everything else the other. It's just as meaningless and just as arbitrary
>> as the opposite would be:
>>
>>     #t is True
>>     everything else is falsey
>> [...]
>> I'd rather the Pascal way:
>>
>>     #t is True
>>     #f is False
>>     everything else is an error
>
> An advantage of the Scheme way is the chaining of "and" and "or". For
> example, this breaks in Python:
>
>    def dir_contents(path):
>        if os.path.isdir(path):
>            return os.listdir(path)
>        return None
>
>    def get_choices():
>        return dir_contents(PRIMARY) or \
>            dir_contents(SECONDARY) or \
>            [ BUILTIN_PATH ]

That depends on what the function is intended to do in the first
place. Why would you want to return the contents of an empty directory
rather than the default?

Anyway, to make that work as you want it in Scheme, dir_contents would
have to return #f, not None. Does it really make sense for a
non-predicate function to be returning the value "false"?

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


Thread

Re: Comparisons and sorting of a numeric class.... Andrew Robinson <andrew3@r3dsolutions.com> - 2015-01-06 18:01 -0800
  Re: Comparisons and sorting of a numeric class.... Steven D'Aprano <steve@pearwood.info> - 2015-01-07 08:10 +0000
    Re: Comparisons and sorting of a numeric class.... Chris Angelico <rosuav@gmail.com> - 2015-01-07 19:21 +1100
    Re: Comparisons and sorting of a numeric class.... Marko Rauhamaa <marko@pacujo.net> - 2015-01-07 12:01 +0200
      Re: Comparisons and sorting of a numeric class.... Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-08 10:46 +1100
        Re: Comparisons and sorting of a numeric class.... Marko Rauhamaa <marko@pacujo.net> - 2015-01-08 08:21 +0200
          Re: Comparisons and sorting of a numeric class.... Ian Kelly <ian.g.kelly@gmail.com> - 2015-01-08 07:57 -0700
            Re: Comparisons and sorting of a numeric class.... Marko Rauhamaa <marko@pacujo.net> - 2015-01-08 21:41 +0200
          Re: Comparisons and sorting of a numeric class.... Chris Kaynor <ckaynor@zindagigames.com> - 2015-01-08 10:44 -0800
            Re: Comparisons and sorting of a numeric class.... Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-09 23:27 +1100
              Re: Comparisons and sorting of a numeric class.... Chris Angelico <rosuav@gmail.com> - 2015-01-09 23:43 +1100
                Re: Comparisons and sorting of a numeric class.... Marko Rauhamaa <marko@pacujo.net> - 2015-01-09 16:28 +0200
                Re: Comparisons and sorting of a numeric class.... Paul Rubin <no.email@nospam.invalid> - 2015-01-09 07:06 -0800
                Re: Comparisons and sorting of a numeric class.... Chris Angelico <rosuav@gmail.com> - 2015-01-10 02:14 +1100
                Re: Comparisons and sorting of a numeric class.... Marko Rauhamaa <marko@pacujo.net> - 2015-01-09 17:16 +0200

csiph-web