Ian Kelly wrote:
On Thu, Apr 19, 2012 at 3:33 PM, Terry Reedy wrote:
On 4/19/2012 1:15 PM, Kiuhnm wrote:
A with statement is not at the module level only if it appears inside a
function definition or a class definition.
This is true, I believe, of all statements.
Am I forgetting something?
On Thu, Apr 19, 2012 at 3:33 PM, Terry Reedy wrote:
> On 4/19/2012 1:15 PM, Kiuhnm wrote:
>>
>> A with statement is not at the module level only if it appears inside a
>> function definition or a class definition.
>
>
> This is true, I believe, of all statements.
>
>> Am I forgetting something?
>
On 4/19/2012 1:15 PM, Kiuhnm wrote:
A with statement is not at the module level only if it appears inside a
function definition or a class definition.
This is true, I believe, of all statements.
Am I forgetting something?
Comprehensions (in Py3) and lambda expressions also introduce new loc
On 4/19/2012 20:02, Jacob MacDonald wrote:
On Thursday, April 19, 2012 10:15:23 AM UTC-7, Kiuhnm wrote:
A with statement is not at the module level only if it appears inside a
function definition or a class definition.
Am I forgetting something?
Kiuhnm
That sounds about right to me. However,
On Thursday, April 19, 2012 10:15:23 AM UTC-7, Kiuhnm wrote:
> A with statement is not at the module level only if it appears inside a
> function definition or a class definition.
> Am I forgetting something?
>
> Kiuhnm
That sounds about right to me. However, I haven't really used with's very mu
Thomas Rachel wrote:
> Am 03.08.2011 04:15 schrieb Steven D'Aprano:
[...]
> > but to me that looks badly wrong. Surely the spam context manager
> > object will exit after the first iteration, and always raise an
> > exception on the second? But I don't quite understand context
> > managers eno
Am 03.08.2011 04:15 schrieb Steven D'Aprano:
> I'm not greatly experienced with context managers and the with
> statement, so I would like to check my logic.
>
> Somebody (doesn't matter who, or where) stated that they frequently
> use this idiom:
>
> spam = MyContextManager(*args)
> for ham in m
On Wed, 03 Aug 2011 12:15:44 +1000, Steven D'Aprano wrote:
> I'm not greatly experienced with context managers and the with statement, so
> I would like to check my logic.
>
> Somebody (doesn't matter who, or where) stated that they frequently use this
> idiom:
>
> spam = MyContextManager(*args)
On Tue, Aug 2, 2011 at 10:15 PM, Steven D'Aprano
wrote:
> I'm not greatly experienced with context managers and the with statement, so
> I would like to check my logic.
>
> Somebody (doesn't matter who, or where) stated that they frequently use this
> idiom:
>
> spam = MyContextManager(*args)
> fo
On Sun, Feb 21, 2010 at 3:21 PM, John Nagle wrote:
> nobrowser wrote:
>>
>> Hi. The with statement is certainly nifty. The trouble is, the
>> *only* two documented examples how it can be used with the library
>> classes are file objects (which I use all the time) and thread locks
>> which I almo
nobrowser wrote:
Hi. The with statement is certainly nifty. The trouble is, the
*only* two documented examples how it can be used with the library
classes are file objects (which I use all the time) and thread locks
which I almost never use. Yet there are many, many classes in the
library whos
On 2/19/2010 2:18 AM, nobrowser wrote:
Hi. The with statement is certainly nifty. The trouble is, the
*only* two documented examples how it can be used with the library
classes are file objects (which I use all the time) and thread locks
which I almost never use. Yet there are many, many class
On 2010-02-19 01:18 AM, nobrowser wrote:
Hi. The with statement is certainly nifty. The trouble is, the
*only* two documented examples how it can be used with the library
classes are file objects (which I use all the time) and thread locks
which I almost never use. Yet there are many, many cla
nobrowser wrote:
> Yet there are many, many classes in the
> library whose use would be more elegant and readable if the with
> statement could be employed. Start with the connection objects in
> httplib and you can probably come up with 10 others easily. Maybe it
> is the case that some of thes
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
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 kno
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
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 read
Great thanks.
On 7/31/07, Carsten Haese <[EMAIL PROTECTED]> wrote:
>
> On Tue, 2007-07-31 at 14:57 -0400, G wrote:
> > Hi,
> >
> >Could somebody please point me to a good resource to read about
> > the contexts, context managers, and with_statement
> >
>
> There's PEP 343 at http://www.python.
On Tue, 2007-07-31 at 14:57 -0400, G wrote:
> Hi,
>
>Could somebody please point me to a good resource to read about
> the contexts, context managers, and with_statement
>
There's PEP 343 at http://www.python.org/dev/peps/pep-0343/. I don't
know if that fits your definition of "good," but it
20 matches
Mail list logo