PEP 343, second look
Paul Rubin
http
Wed Jun 22 16:09:51 EDT 2005
Ron Adam <rrr at ronadam.com> writes:
> > A new statement is proposed with the syntax:
> > with EXPR as VAR:
> > BLOCK
> > Here, 'with' and 'as' are new keywords; EXPR is an arbitrary
> > expression (but not an expression-list)...
>
> How is EXPR arbitrary? Doesn't it need to be or return an object that
> the 'with' statement can use? (a "with" object with an __enter__ and
> __exit__ method?)
That's not a syntactic issue. "x / y" is a syntactically valid
expression even though y==0 results in in a runtime error.
More information about the Python-list
mailing list