On 16/03/2016 21:43, Mark Lawrence wrote:
On 16/03/2016 19:41, BartC wrote:

That article appears to try to do without using a new switch byte-code,
as the author doesn't see the point. My code to implement a 'switch'
byte-code (for integer expression and constant integer case-expressions)
is below.

Job done then.  Raise an issue on the bug tracker and the extremely
simple task of having a switch/case statement in Python is solved.  How
the dumbo core developers didn't see this in the first place I'll just
never know.

The technical side is not the problem. But the language, the size of it, the organisation behind it, and the myriad implementations, is a monster.

I'm not interested in battling with that or all the people who don't want change. Plus the problems of keeping backwards compatibility.

But if you're talking about the code to implement 'switch', then yes it can be that simple. Although it seems no one is going to agree on the exact form it would take.

(If I wanted to code in Python, and really wanted a switch statement, then I would do a syntax translator, which I have already experimented with in the past.

So I would write code in 'Python+switch', and translate to normal Python being running it. Then I get some of the benefits immediately. What I don't get however is the performance that could go with it if it was a real part of the language.)

--
Bartc
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to