Basic question about speed/coding style/memory

Andrew Berg bahamutzero8825 at
Sat Jul 21 11:05:27 CEST 2012

On 7/21/2012 3:13 AM, Jan Riechers wrote:
> Cause, as I understand the interpreter chooses either the "else" (1st 
> block) or just proceeds with following code outside the if.
If none of the if/elif statements evaluate to something true, the else
block is executed.

> So if there is some overhead in some fashion in case we don't offer the 
> else, assuming the interpreter has to exit the evaluation of the 
> "if"-statement clause and return to a "normal parsing code"-state 
> outside the if statement itself.
I really don't understand. You can look into the dis module if you want
to look at how CPython bytecode is executed and the timeit module to
measure speed. In any case, I don't see how there would be any
significant difference.
CPython 3.3.0b1 | Windows NT 6.1.7601.17803

More information about the Python-list mailing list