On Fri, Apr 18, 2014 at 10:03 AM, Joao S. O. BuenoI haven't been following this thread closely, so I don't know if Lucas
<jsbueno@python.org.br> wrote:
> It may be just me, but I fail - in a complete manner - to see how this
> syntax can offer any
> improvement on current if/elif chains.
has mentioned more than syntax, however...
In other languages, the semantics of the switch statement allow the
compiler to generate more efficient code. Instead of testing each
branch of the if statement in succession looking for a match, you
evaluate the switch expression once, then use it as an index into a
jump table of some sort which points directly to the matching case
label. If nothing matches, you jump to the default branch (if one was
defined) or just jump over the entire switch statement (if not).
Skip
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/
http://www.voidspace.org.uk/
May you do good and not evil
May you find forgiveness for yourself and forgive others
May you share freely, never taking more than you give.
-- the sqlite blessing http://www.sqlite.org/different.html