Re: with statement for two files

2008-07-28 Thread Paul Rubin
braver [EMAIL PROTECTED] writes: with open(src) as readin, open(dst,w) as writin: # WRONG: comma doesn't work ... -- so that you have transactional safety for two file descriptors? use contextlib.nexted(). -- http://mail.python.org/mailman/listinfo/python-list

Re: with statement for two files

2008-07-28 Thread Diez B. Roggisch
Paul Rubin wrote: braver [EMAIL PROTECTED] writes: with open(src) as readin, open(dst,w) as writin: # WRONG: comma doesn't work ... -- so that you have transactional safety for two file descriptors? use contextlib.nexted(). You mean contextlib.nested I guess. Didn't know about that

Re: with statement for two files

2008-07-28 Thread greg
Diez B. Roggisch wrote: Paul Rubin wrote: use contextlib.nexted(). You mean contextlib.nested I guess. Although nexted is an intriguing-sounding word. I wonder what it could mean? -- Greg -- http://mail.python.org/mailman/listinfo/python-list

with statement for two files

2008-07-27 Thread braver
Can open two files in a with statement: with open(src) as readin, open(dst,w) as writin: # WRONG: comma doesn't work ... -- so that you have transactional safety for two file descriptors? The comma syntax doesn't work, but is there a way, except for with open(src) as readin: with

Re: with statement for two files

2008-07-27 Thread Diez B. Roggisch
braver schrieb: Can open two files in a with statement: with open(src) as readin, open(dst,w) as writin: # WRONG: comma doesn't work ... -- so that you have transactional safety for two file descriptors? The comma syntax doesn't work, but is there a way, except for with open(src) as