[Python-Dev] Merging PEP 310 and PEP 340-redux?

Guido van Rossum gvanrossum at gmail.com
Fri May 13 04:15:56 CEST 2005


[Shane Hathaway]
> If it's this simple, it should be possible to write something that
> combines the acquisition of multiple resources in a single statement.
> For example:
> 
>     with combining(opening(src_fn), opening(dst_fn, 'w')) as src, dst:
>         copy(src, dst)

Yeah (and I don't see anything wrong with your implementation of
combining either), but even if that existed I think I'd prefer to just
write

  with opening(src_fn) as src:
      with opening(dst_fn) as dst:
          copy(src, dst)

See Ma, no magic! :-)

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list