[Python-Dev] Multiline 'with' statement line continuation (original) (raw)
Ben Hoyt benhoyt at gmail.com
Tue Aug 12 02:29:51 CEST 2014
- Previous message: [Python-Dev] Multiline ‘with’ statement line continuation
- Next message: [Python-Dev] Multiline 'with' statement line continuation
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Even if it weren't a syntax error, the syntax would be ambiguous. How will you discern the meaning of::
with ( foo, bar, baz): pass Is that three separate context managers? Or is it one tuple with three items?
Is it meaningful to use "with" with a tuple, though? Because a tuple isn't a context manager with enter and exit methods. For example:
with (1,2,3): pass ... Traceback (most recent call last): File "", line 1, in AttributeError: exit
So -- although I'm not arguing for it here -- you'd be turning an code (a runtime AttributeError) into valid syntax.
-Ben
- Previous message: [Python-Dev] Multiline ‘with’ statement line continuation
- Next message: [Python-Dev] Multiline 'with' statement line continuation
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]