◐ Shell
clean mode source ↗

Message 349570 - Python tracker

My apologies if I missed something, but do we have a consensus on the desired solution?

My understanding of `try/finally` is that whatever happens in the `finally` clause should:

- always happen
- win any conflicts with `try` clause

For example:

  try:
     a = 2
  finally:
     a = 3
  print(a)
  # 3

and

  def f():
     try:
        return 5
     finally:
        return 7
  print(f())
  # 7

So it seems like the ideal solution to:

  def mult(thing):
      print(thing*2)
      return thing * 2

  def simple():
      for number in range(2):
          try:
              return mult(number)
          finally:
              continue
  print(simple())

would be:

  0
  2
  None