with statement
Terry Reedy
tjreedy at udel.edu
Thu Apr 19 17:33:48 EDT 2012
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 local
scopes -- because they are abbreviated def statements. But they cannot
contain statements, only expressions, in that new scope.
--
Terry Jan Reedy
More information about the Python-list
mailing list