with statement
Jacob MacDonald
jaccarmac at gmail.com
Thu Apr 19 14:02:49 EDT 2012
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.)
More information about the Python-list
mailing list