> I'm saying, don't even try to distinguish between the forms with or > without parens. If we add parens: > > with (expr as name): > > it may or may not be allowed some time in the future (since it isn't > allowed now, but there are many requests for it) but if it is allowed, > it will still mean a context manager and not assignment expression. > > (In case it isn't obvious, I'm saying that we need not *require* parens > for this feature, at least not if the only reason for doing so is to > make the with/except case unambiguous.) >
So if I read this correctly, you're making an argument to ignore parens ? If I'd type with (expr as name) as othername:, I'd expect the original value of expr in my name and the context manager's __enter__ return value in othername. I don't really see any ambiguity in that case. Without parens -> old syntax + meaning with parens -> bind expr to name, because that's what the parens say. Ignoring parens, in any way, just seems like a bad idea. If you want to avoid with(expr as name):, shouldn't you make parens illegal ? _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/