Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #83363
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ckaynor@zindagigames.com> |
| 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.02; 'algorithm': 0.04; 'plenty': 0.07; 'python:': 0.09; 'way:': 0.09; 'def': 0.12; 'jan': 0.12; '"and"': 0.16; '>>': 0.16; 'acted': 0.16; 'be:': 0.16; 'merely': 0.16; 'none.': 0.16; 'opposite': 0.16; 'tables,': 0.16; 'underlying': 0.16; 'wished': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'bit': 0.19; 'thu,': 0.19; '>>>': 0.22; 'email addr:gmail.com>': 0.22; 'previously': 0.22; 'error': 0.23; '>>>': 0.24; "i've": 0.25; '>': 0.26; 'second': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; "d'aprano": 0.31; 'pascal': 0.31; 'steven': 0.31; 'this.': 0.32; 'quite': 0.32; 'sense': 0.34; 'skip:d 20': 0.34; "i'd": 0.34; 'received:74.125.82': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'really': 0.36; 'false': 0.36; 'returning': 0.36; 'scheme': 0.36; 'doing': 0.36; 'example,': 0.37; 'skip:o 20': 0.38; 'skip:& 10': 0.38; 'depends': 0.38; 'to:addr:python- list': 0.38; 'pm,': 0.38; 'rather': 0.38; 'received:74.125': 0.39; 'does': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'ian': 0.60; 'first': 0.61; 'times': 0.62; 'skip:n 10': 0.64; 'believe': 0.68; 'superior': 0.69; 'other.': 0.75; '2015': 0.84; 'lately,': 0.84 |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type; bh=eaWm7yUouEekvLobuirLOuwGOY+GFZCl/WXeYILN+ys=; b=Q0DYKvsTZoSj6XNgyKq9KrJmID18pRDJ5Nw6kzJ4XyFVypR2/wu72h0AHTPGRlZkHw r93uAVqpgBphCMUEiVb1gdilZrEO9/QtlcOX6rtC/n77cW00vOdBsh4U402oOtubV4ES CMBDz97wGiWi1C128Wb80w6sdSUxq7PDnmh6ZKDYs5rh83ytmcY030yHKGNuHMk7WnP2 Amfv3Ijg6NcGAwwnESndnij9xIRgsc79x+OD5VtH8/9APZ45S0m2tzcX8sBWLSaUqu/B Q2QVGADDSbJrEfYKulhB0KoQUev6qkpnKam/cTd8FV0kaHJ4GRMsLoj66GJ8jq20d0D1 ZkCA== |
| X-Gm-Message-State | ALoCoQknJAUhPiUX1W5CZTOnYOqM1AM1TcD20a5fZTpOJIyNOP2UEvKLcvWtkUeZKDQsiT7sU/j0 |
| X-Received | by 10.180.109.3 with SMTP id ho3mr63349151wib.39.1420742699194; Thu, 08 Jan 2015 10:44:59 -0800 (PST) |
| MIME-Version | 1.0 |
| In-Reply-To | <CALwzidkn5E3uxQ3Et9r-0_WUTjPLfHtY7mqwnhNVe2MGCi528Q@mail.gmail.com> |
| 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> <CALwzidkn5E3uxQ3Et9r-0_WUTjPLfHtY7mqwnhNVe2MGCi528Q@mail.gmail.com> |
| From | Chris Kaynor <ckaynor@zindagigames.com> |
| Date | Thu, 8 Jan 2015 10:44:39 -0800 |
| Subject | Re: Comparisons and sorting of a numeric class.... |
| To | Python <python-list@python.org> |
| Content-Type | multipart/alternative; boundary=e89a8f3b9dafe72e3b050c286fd5 |
| 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.17483.1420742711.18130.python-list@python.org> (permalink) |
| Lines | 128 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1420742711 news.xs4all.nl 2970 [2001:888:2000:d::a6]:59803 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:83363 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
On Thu, Jan 8, 2015 at 6:57 AM, Ian Kelly <ian.g.kelly@gmail.com> wrote: > 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"? I'd like to second this. I don't believe either way is inherently superior to the other. Lately, I've been doing quite a bit of work in lua, and many times have wished that empty strings, tables, and 0 acted "falsey", but at the same time, previously working in Python, there were plenty of times I wished they acted "truthy". It merely depends on what algorithm I am using at the time...
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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