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


Groups > comp.lang.python > #104892

Re: Encapsulation in Python

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: Encapsulation in Python
Date Tue, 15 Mar 2016 11:58:40 +1100
Lines 14
Message-ID <mailman.147.1458003523.12893.python-list@python.org> (permalink)
References <56E17985.7060002@benmezger.nl> <mailman.139.1457623672.15725.python-list@python.org> <6984dafc-fffd-4d46-a173-421bb5c142d2@googlegroups.com> <mailman.25.1457711277.26429.python-list@python.org> <4ddc3696-3f71-4598-98a6-929267f51fb9@googlegroups.com> <mailman.42.1457801128.12893.python-list@python.org> <56e53cd3$0$1586$c3e8da3$5496439d@news.astraweb.com> <1376c684-2e7f-417a-9683-e47789f019fe@googlegroups.com> <CALwzidm0PPzMBNYFyxhAv0Y3-2dLRA0J8wbcD6Qj5tGYf37SAQ@mail.gmail.com> <mailman.132.1457990663.12893.python-list@python.org> <nc7chi$lbu$1@dont-email.me> <mailman.133.1457994074.12893.python-list@python.org> <nc7ef9$sgf$1@dont-email.me> <mailman.137.1457997645.12893.python-list@python.org> <nc7it9$ejq$1@dont-email.me> <mailman.138.1458000749.12893.python-list@python.org> <nc7man$obt$1@dont-email.me>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de q6fVkdt9FFYTEHsZF5C8QQVCWrL5qGITPecmnlkhZ0gg==
Return-Path <rosuav@gmail.com>
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; 'python,': 0.02; 'received:209.85.223': 0.03; 'subject:Python': 0.05; 'cc:addr :python-list': 0.09; 'integers': 0.09; 'semantics': 0.09; '2016': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'hashable': 0.16; 'integers,': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'restricting': 0.16; 'sequence.': 0.16; 'wrote:': 0.16; 'tests': 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'am,': 0.23; 'header:In-Reply-To:1': 0.24; 'message-id:@mail.gmail.com': 0.27; 'restrict': 0.27; 'equality': 0.29; 'types.': 0.29; "i'm": 0.30; '15,': 0.30; 'tue,': 0.34; 'received:google.com': 0.35; 'received:209.85': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'expect': 0.37; 'received:209': 0.38; 'sure': 0.39; 'does': 0.39; 'mar': 0.65; 'gain': 0.82; 'chrisa': 0.84; 'to:none': 0.91; 'subject:skip:E 10': 0.96
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc; bh=YZ5+l1L8qT+Fq2w2bR6hCUlMm2LXY4h6XO4aiGpcm4A=; b=g4/n9hdoEeoW0jATkhPDB/SJmf9D9rkAqQCczSMMSG9ewkmm6hHFIg1uSArcwz6jjt TkbVcjlieMZwlK/D1klN7oQhiUBjadvTKEREmVRYndHpCB+17Gt3+MPrIDXGtJ9U9Ucw Khl51F+7xuEBq5B9U3PpYo9Y9FumreLYgXMV9otMSY0JgajtZPjkyP5LFqJAaK0uwC3R JgOKNHbU7yVjZFIsDXeNIsPuDgBQuOynXGHksL794pMUgzvzHwKAn3wm0BzZd0KCWRIV lEo9SX6OrwRA6UX49bYGpKXq+I79mdrqnQVVq3ja45F/8ZDj2UWzZL+QkdnPZ3bVdS/p 6qGw==
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:date :message-id:subject:from:cc; bh=YZ5+l1L8qT+Fq2w2bR6hCUlMm2LXY4h6XO4aiGpcm4A=; b=iMBKg3hEu5W97Ki6PJj/jPHrSzAuwli46qaJ0cvUeTT+Wjpm37yBCYOiz5/7Wh0lHH R8FQFVguq1tJt27GhgJKDHr5PgbFmAdvUfblop1XHuPVwvY54N+3x4TRcCh3FtyY6KvT VlDeJznBLpyG0UJE4VRbS8Yv/nuJtJ+IlfDUuzAJPftDziGzsCwF5yb0NmrtGi+6iBlf noBEPD7LejnZv4ah5lrw7/oWKUSmRYPw7P/kPg6ptYMlYQp1svPhI57mCDNOxYk8KGVI AsLWzN98kTZmumiJSjgtnpRhIgRdLHpJsSGB93saiB1E/A76ye8Pt4mYcFJ4mVA2VgSh pM2Q==
X-Gm-Message-State AD7BkJILvayjVrv9FDwDI7Mosr3d6QyB8mj0veSGdnblGU8qKu8HE0G4FbVxVtWGR4TAcWO6yvoxRG7oms9k1Q==
X-Received by 10.107.138.75 with SMTP id m72mr26569879iod.31.1458003520805; Mon, 14 Mar 2016 17:58:40 -0700 (PDT)
In-Reply-To <nc7man$obt$1@dont-email.me>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.21
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>
Xref csiph.com comp.lang.python:104892

Show key headers only | View raw


On Tue, Mar 15, 2016 at 11:54 AM, BartC <bc@freeuk.com> wrote:
>> In Python, there's no reason to restrict 'switch'
>> to integers, so I would expect its semantics to be based on either
>> equality comparisons or inequality comparisons
>
>
> I use two forms of switch: one for integers only (very fast), and the other
> for any other values, which does tests in sequence.

I'm not sure what you gain by restricting to integers that you
couldn't also gain with other hashable types. Can you elaborate on
these optimizations?

ChrisA

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


Thread

Re: Encapsulation in Python Ian Kelly <ian.g.kelly@gmail.com> - 2016-03-10 08:27 -0700
  Re: Encapsulation in Python Rick Johnson <rantingrickjohnson@gmail.com> - 2016-03-10 16:45 -0800
    Re: Encapsulation in Python Ian Kelly <ian.g.kelly@gmail.com> - 2016-03-11 08:47 -0700
      Re: Encapsulation in Python Rick Johnson <rantingrickjohnson@gmail.com> - 2016-03-11 18:39 -0800
        Re: Encapsulation in Python Ian Kelly <ian.g.kelly@gmail.com> - 2016-03-12 09:44 -0700
          Re: Encapsulation in Python Rick Johnson <rantingrickjohnson@gmail.com> - 2016-03-12 19:11 -0800
          Re: Encapsulation in Python Steven D'Aprano <steve@pearwood.info> - 2016-03-13 21:11 +1100
            Re: Encapsulation in Python Rick Johnson <rantingrickjohnson@gmail.com> - 2016-03-14 10:32 -0700
              Re: Encapsulation in Python Ian Kelly <ian.g.kelly@gmail.com> - 2016-03-14 15:09 -0600
              Re: Encapsulation in Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-14 21:23 +0000
                Re: Encapsulation in Python BartC <bc@freeuk.com> - 2016-03-14 22:07 +0000
                Re: Encapsulation in Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-14 22:20 +0000
                Re: Encapsulation in Python BartC <bc@freeuk.com> - 2016-03-14 22:40 +0000
                Re: Encapsulation in Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-14 23:19 +0000
                Re: Encapsulation in Python BartC <bc@freeuk.com> - 2016-03-14 23:56 +0000
                Re: Encapsulation in Python Chris Angelico <rosuav@gmail.com> - 2016-03-15 11:12 +1100
                Re: Encapsulation in Python BartC <bc@freeuk.com> - 2016-03-15 00:54 +0000
                Re: Encapsulation in Python Chris Angelico <rosuav@gmail.com> - 2016-03-15 11:58 +1100
                Re: Encapsulation in Python BartC <bc@freeuk.com> - 2016-03-15 01:22 +0000
                Re: Encapsulation in Python Chris Angelico <rosuav@gmail.com> - 2016-03-15 13:02 +1100
                Re: Encapsulation in Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-15 00:28 +0000
                Re: Encapsulation in Python BartC <bc@freeuk.com> - 2016-03-15 01:10 +0000
                Re: Encapsulation in Python Chris Angelico <rosuav@gmail.com> - 2016-03-15 12:23 +1100
                Re: Encapsulation in Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-15 04:41 +0000
                Re: Encapsulation in Python rurpy@yahoo.com - 2016-03-14 17:17 -0700
                Re: Encapsulation in Python Chris Angelico <rosuav@gmail.com> - 2016-03-15 11:25 +1100
                Re: Encapsulation in Python Steven D'Aprano <steve@pearwood.info> - 2016-03-15 13:06 +1100
                Re: Encapsulation in Python Chris Angelico <rosuav@gmail.com> - 2016-03-15 13:14 +1100
                Re: Encapsulation in Python Steven D'Aprano <steve@pearwood.info> - 2016-03-15 13:40 +1100
                Re: Encapsulation in Python Rick Johnson <rantingrickjohnson@gmail.com> - 2016-03-14 21:08 -0700
                Re: Encapsulation in Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-15 00:47 +0000
                Re: Encapsulation in Python Steven D'Aprano <steve@pearwood.info> - 2016-03-15 13:46 +1100
                Re: Encapsulation in Python Chris Angelico <rosuav@gmail.com> - 2016-03-15 11:56 +1100
                Re: Encapsulation in Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-15 04:36 +0000
                Re: Encapsulation in Python Steven D'Aprano <steve@pearwood.info> - 2016-03-15 13:01 +1100
                Re: Encapsulation in Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-15 04:45 +0000
                Re: Encapsulation in Python Christian Gollwitzer <auriocus@gmx.de> - 2016-03-15 22:02 +0100
                Re: Encapsulation in Python BartC <bc@freeuk.com> - 2016-03-16 00:39 +0000
                Re: Encapsulation in Python BartC <bc@freeuk.com> - 2016-03-16 22:58 +0000
        Re: Encapsulation in Python sohcahtoa82@gmail.com - 2016-03-14 11:11 -0700
          Re: Encapsulation in Python Rick Johnson <rantingrickjohnson@gmail.com> - 2016-03-14 23:09 -0700
      Re: Encapsulation in Python Rick Johnson <rantingrickjohnson@gmail.com> - 2016-03-11 18:56 -0800
    Re: Encapsulation in Python Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-03-12 13:52 +1300
      Re: Encapsulation in Python Rick Johnson <rantingrickjohnson@gmail.com> - 2016-03-12 08:49 -0800
        Re: Encapsulation in Python Chris Angelico <rosuav@gmail.com> - 2016-03-13 08:10 +1100
          Re: Encapsulation in Python Rick Johnson <rantingrickjohnson@gmail.com> - 2016-03-12 19:36 -0800
            Re: Encapsulation in Python Chris Angelico <rosuav@gmail.com> - 2016-03-13 15:05 +1100
        Re: Encapsulation in Python Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-03-14 12:35 +1300
          Re: Encapsulation in Python Rick Johnson <rantingrickjohnson@gmail.com> - 2016-03-14 15:55 -0700

csiph-web