[Python-Dev] Where to put the interrupt module?

Kevin Jacobs jacobs@penguin.theopalgroup.com
Fri, 13 Jun 2003 09:20:33 -0400 (EDT)


On Fri, 13 Jun 2003, Guido van Rossum wrote:
> There's also a race condition in the language design that would need
> to be fixed before I'd like to have this feature.  As you know, the
> proper idiom for using locks is:
> 
>   lock.acquire()
>   try:
>       ...critical section code...
>   finally:
>       lock.release()

This just reminded me of a question that has been floating around in my
brain for a while.  Why doesn't Python support the following fully general
syntax for try-blocks:

  try:
    foo()
  except blah:
    ...
  except:
    ...
  else:
    ...
  finally:
    ...

I keep having to write:

  try:
    try:
      foo()
    except blah:
      ...
    except:
      ...
    else:
      ...
  finally:
    ...

-Kevin

-- 
--
Kevin Jacobs
The OPAL Group - Enterprise Systems Architect
Voice: (216) 986-0710 x 19         E-mail: jacobs@theopalgroup.com
Fax:   (216) 986-0714              WWW:    http://www.theopalgroup.com