Re: Basic question about speed/coding style/memory

Discussion in 'Python' started by Andrew Berg, Jul 21, 2012.

  1. Andrew Berg

    Andrew Berg Guest

    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
    Andrew Berg, Jul 21, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. calmar
    Replies:
    11
    Views:
    749
    calmar
    Feb 21, 2006
  2. Jan Riechers
    Replies:
    6
    Views:
    169
    88888 Dihedral
    Jul 23, 2012
  3. Andrew Berg
    Replies:
    0
    Views:
    101
    Andrew Berg
    Jul 21, 2012
  4. Jan Riechers
    Replies:
    0
    Views:
    106
    Jan Riechers
    Jul 21, 2012
  5. Chris Angelico
    Replies:
    2
    Views:
    147
    88888 Dihedral
    Jul 23, 2012
Loading...

Share This Page