Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   Re: Basic question about speed/coding style/memory (http://www.velocityreviews.com/forums/t948339-re-basic-question-about-speed-coding-style-memory.html)

Andrew Berg 07-21-2012 09:05 AM

Re: Basic question about speed/coding style/memory
 
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.

http://docs.python.org/py3k/library/dis.html
http://docs.python.org/py3k/library/timeit.html
--
CPython 3.3.0b1 | Windows NT 6.1.7601.17803


All times are GMT. The time now is 06:36 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.