Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #104915
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
| Newsgroups | comp.lang.python |
| Subject | Re: Encapsulation in Python |
| Date | Tue, 15 Mar 2016 04:41:30 +0000 |
| Lines | 65 |
| Message-ID | <mailman.153.1458016938.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.140.1458001784.12893.python-list@python.org> <nc7n8k$qru$1@dont-email.me> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=windows-1252; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Trace | news.uni-berlin.de F3LcXjRvg+GxDk2Ny0JiewWg+9lDime+b6K0thfEhfqA== |
| 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.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'value,': 0.03; 'subject:Python': 0.05; 'cpython': 0.05; 'from:addr:yahoo.co.uk': 0.05; 'rejected': 0.05; 'executed': 0.07; 'expressions': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'bug': 0.10; 'python': 0.10; 'python.': 0.11; 'language,': 0.11; 'index': 0.13; 'missed': 0.15; "(i'm": 0.16; 'deprive': 0.16; 'provision': 0.16; 'really?': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'switch.': 0.16; 'task.': 0.16; 'wrote:': 0.16; 'case.': 0.18; 'tests': 0.18; 'language': 0.19; '>>>': 0.20; 'meant': 0.22; 'lawrence': 0.22; 'code,': 0.23; 'patch': 0.24; 'header:In-Reply- To:1': 0.24; 'testing': 0.25; "i've": 0.25; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'switch': 0.27; 'least': 0.27; 'sequence': 0.27; 'function': 0.28; 'actual': 0.28; 'looks': 0.29; 'pep': 0.29; "i'm": 0.30; 'too.': 0.30; 'code': 0.30; 'branch': 0.30; 'another': 0.32; 'language.': 0.32; 'statement': 0.32; 'getting': 0.33; 'jump': 0.33; 'running': 0.34; 'done': 0.35; 'clear': 0.35; 'label': 0.35; 'something': 0.35; 'but': 0.36; 'should': 0.36; 'needed': 0.36; 'there': 0.36; "wasn't": 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'agree': 0.37; 'received:org': 0.37; 'anything': 0.38; 'building': 0.38; 'test': 0.39; 'sure': 0.39; 'rather': 0.39; 'to:addr:python.org': 0.40; 'where': 0.40; 'mark': 0.40; 'some': 0.40; 'easy': 0.60; 'your': 0.60; 'provide': 0.61; 'show': 0.62; 'total': 0.62; 'yes': 0.62; 'details': 0.62; 'charset:windows-1252': 0.62; 'above,': 0.63; 'strange': 0.63; 'more': 0.63; 'profile': 0.63; 'interest': 0.64; 'within': 0.64; 'our': 0.64; 'you.': 0.64; 'respect': 0.65; 'results.': 0.67; 'yourself': 0.73; 'calls,': 0.84; 'of?': 0.84; 'pythonistas,': 0.84; 'terrible': 0.84; 'yourself...': 0.84; 'refuse': 0.93; 'subject:skip:E 10': 0.96 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| X-Gmane-NNTP-Posting-Host | 80.234.129.0 |
| User-Agent | Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 |
| In-Reply-To | <nc7n8k$qru$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:104915 |
Show key headers only | View raw
On 15/03/2016 01:10, BartC wrote: > On 15/03/2016 00:28, Mark Lawrence wrote: >> On 14/03/2016 23:56, BartC wrote: > >>> Anything so terrible about that that Python needs to keep well clear of >>> or that you think its users should be deprived of? >> >> Yes, it is not even valid Python. Switch has been rejected via at least >> one PEP and from what I see it adds nothing to the language, so let's >> deprive it from people who clearly don't need it in the first place. > > Every time you need to test X against more than one other value, then > you have a potential use for switch. > > But yes you can do without switch if you have too. Same for many features. > >> I am only rude to people such as yourself who refuse to provide code, in >> fact anything, to support your case. Your "benchmark" for the switch >> was yet another laughable farce, which only tested the function calls, >> building tuples, running loops, there was nothing to test with respect >> to the actual switch which was meant to be tested. So just in case you >> missed it above, where is the profile for this test? > > I've shown the task. I'm sure you can also do some tests and show us > some results. > >>> I agree with you. But once you've got the language right, then there's >>> no harm looking at performance. A switch statement like the above can be >>> executed in a single byte-code. >>> >> >> Really? Then please show us all just how it can be done via a patch to >> the cPython code on the bug tracker. > > The one-byte-code switch works when all case expressions are known at > compile-time. It makes use of a jump-table within the byte-code. > > The total sequence will be more than one byte-code, typically: > > LOAD_FAST The index > SWITCH Jump to the right label > .... > L5: One of multiple labels > ... Deal with the code in this branch > JUMP_ABSOLUTE Break out of the switch > > ... Provision is needed for the jump-table > > But only one is needed for testing and dispatch. Now I've sketched it > out, perhaps you can fill in the details for yourself... (I'm not > getting involved in CPython development.) > > I have no interest at this level. If I were I might as well have stuck with C in the first place. I do find it rather strange that something so simple wasn't approved when the PEP(s) were discussed as it looks so easy to implement. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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