with statement

Kiuhnm kiuhnm03.4t.yahoo.it
Thu Apr 19 14:21:42 EDT 2012


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, I haven't really used with's very much. So why would it matter where the statement is? (The only possibility that occurs to me is if your __enter__ or __exit__ methods reference a variable at some arbitrary level.)

You'll see. It's related to my post 'Bug in Python'.

Kiuhnm



More information about the Python-list mailing list