try: finally: question

Tim Peters tim.peters at gmail.com
Fri Jul 16 13:37:32 EDT 2004


[Joshua Marshall]
> Why is this not an argument

'finally' wasn't removed based on "an argument", it was removed based
on negative feedback from real experience.  What you give here
certainly is "an argument", but this wasn't an argument-based
decision.

> for disallowing multiple except blocks, like:>
>
>  try:
>     raise A()
>  except A:
>     raise B()
>  except B:
>     print 'Did we get here?'

Because there's no evidence that anyone is confused by this in
practice.  There was ample evidence that many people were confused in
practice when a 'finally' clause was allowed too.

> This is legal and well-defined in Python.  If try/except/finally was
> removed it seems like multiple except blocks should have been removed
> too--the behavior of one is as obvious as the other.

So you say, but experience said otherwise.  You can speculate about
why if you want to, but it's a fact -- for whatever reason, Python
programmers in real life are not confused by multiple 'except' blocks,
but were confused about the semantics of allowing 'finally' too at the
same level.  No amount of argument can change that -- it was an
observation, not a deduction.



More information about the Python-list mailing list