Author Neal.Norwitz
Recipients Neal.Norwitz
Date 2013-03-15.18:38:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1363372721.86.0.440516031889.issue17430@psf.upfronthosting.co.za>
In-reply-to
Content
>>> def fo():
...   if a:
...     if b:
...      if c:
...        print
... 
>>> dis.dis(fo)
  2           0 LOAD_GLOBAL              0 (a)
              3 POP_JUMP_IF_FALSE       28

  3           6 LOAD_GLOBAL              1 (b)
              9 POP_JUMP_IF_FALSE       28

  4          12 LOAD_GLOBAL              2 (c)
             15 POP_JUMP_IF_FALSE       25

  5          18 PRINT_NEWLINE       
             19 JUMP_ABSOLUTE           25
             22 JUMP_ABSOLUTE           28
        >>   25 JUMP_FORWARD             0 (to 28)
        >>   28 LOAD_CONST               0 (None)
             31 RETURN_VALUE        

The 2 JUMP_ABSOLUTEs should be optimized away since the code is equivalent to: if a and b and c: as in:

>>> dis.dis(fo)
  2           0 LOAD_GLOBAL              0 (a)
              3 POP_JUMP_IF_FALSE       22
              6 LOAD_GLOBAL              1 (b)
              9 POP_JUMP_IF_FALSE       22
             12 LOAD_GLOBAL              2 (c)
             15 POP_JUMP_IF_FALSE       22

  3          18 PRINT_NEWLINE       
             19 JUMP_FORWARD             0 (to 22)
        >>   22 LOAD_CONST               0 (None)
             25 RETURN_VALUE
History
Date User Action Args
2013-03-15 18:38:41Neal.Norwitzsetrecipients: + Neal.Norwitz
2013-03-15 18:38:41Neal.Norwitzsetmessageid: <1363372721.86.0.440516031889.issue17430@psf.upfronthosting.co.za>
2013-03-15 18:38:41Neal.Norwitzlinkissue17430 messages
2013-03-15 18:38:41Neal.Norwitzcreate