Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #104884
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Encapsulation in Python |
| Date | 2016-03-15 00:28 +0000 |
| Message-ID | <mailman.140.1458001784.12893.python-list@python.org> (permalink) |
| References | (10 earlier) <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> |
On 14/03/2016 23:56, BartC wrote:
> On 14/03/2016 23:19, Mark Lawrence wrote:
>> On 14/03/2016 22:40, BartC wrote:
>
>>> Was that in Python? It was /supposed/ to be dreadful. I was making a
>>> case for it to be supported directly.
>>
>> You mean the huge great long list of hard coded function calls. They
>> are directly supported. So is the loop. Anything wrong with the Paul
>> Rubin response?
>
> I tried it. It wasn't bad, but still 1/3 the speed of an if-elif chain
> with discrete range-checking.
I still haven't seen the profile that I asked for, so I've no idea what
is taking the time.
>
>> And as my earlier link showed you often simply don't
>> need a switch statement in an OO language. Not much point providing
>> something, much worse optimising it, if it isn't needed in the first
>> place?
>
> I disagree. And presumably so do others as there are so many different
> attempts to implement switch, with varying degrees of success. Here's
> how I do it outside Python:
>
> switch c
> when 'A'..'Z','a'..'z','_' then
> ++name
> when '0'..'9' then
> ++numeric
> when "()[]<>{}" then
> ++brackets
> else
> ++other
> end
>
> 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.
>
>>> Sorry, I'm not going to do that, and I don't expect anyone here to have
>>> to do so either. You will have to take my posts as they are.
>>>
>>
>> Drivel. Any establised member of this community, or any other community
>> for that matter, will always publish, unless, like the RUE, they've got
>> something to hide. So you're just a chicken. Where do you buy the
>> paint from for the streaks down your back?
>
> OK, we've got another Rod Speed! He also gets a kick out of being rude
> and insulting to everyone.
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? Do you even know
what a profile is?
>
>> on the grounds that speed simply is not
>> the sole criteria for a language.
>
> 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.
--
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