The actual interpreter code is irrelevant. Switch would be a feature of the 
language being interpreted, not of the interpreter.

If the task is to match an expression X against a variety of values, then 
expressing that as a switch means the interpreter /could/ use a jump table (of 
labels within the byte code), rather than execute a chain of X==Y tests within 
byte code. So, evaluate X once then it could be a single byte code op.

At least, it will know that exactly the same X value is being tested. So you 
evaluate it once then keep it on the stack.

Think of Switch as another kind if hint.

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

Reply via email to