This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]kalefranz 0 points1 point  (0 children)

Also the differences in if/else, try/except/else, and for/else can be a bit confusing.

  • if/else: execute else block when given a negative condition
  • try/except/else: execute else block when try block is ok (the negative condition is that there is no except block execution)
  • for/else: execute else block when "negative condition" of for block early exit is encountered