[Python-Dev] PEP 572: Assignment Expressions
Guido van Rossum
guido at python.org
Mon Apr 23 18:36:10 EDT 2018
Using 'as' was debated extensively on python-ideas. I don't like it for
several reasons:
- the semantics are subtly different from all other uses of 'as' in Python;
I'd like to reserve 'as' for "not a plain assignment"
- a short word is easier to miss when skimming code than punctuation
- most other languages (Java*, C*) borrow from assignment (name = expr)
On Mon, Apr 23, 2018 at 3:19 PM, Ned Deily <nad at python.org> wrote:
> On Apr 23, 2018, at 18:04, Tim Peters <tim.peters at gmail.com> wrote:
> > However, against "as" is that its current use in "with" statements
> > does something quite different:
> >
> > with f() as name:
> >
> > does not bind the result of `f()` to `name`, but the result of
> > `f().__enter__()`. Whether that "should be" fatal, I don't know, but
> > it's at least annoying ;-)
>
> Prior art: COBOL uses "GIVING", as in:
>
> ADD x, y GIVING z
>
> No need to re-invent the wheel ;)
>
> --
> Ned Deily
> nad at python.org -- []
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/
> guido%40python.org
>
--
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20180423/3005d57d/attachment.html>
More information about the Python-Dev
mailing list