[Python-ideas] Spelling of Assignment Expressions PEP 572 (was post #4)

Thautwarm Zhao yaoxiansamma at gmail.com
Sun Apr 15 10:27:09 EDT 2018


> To me, "from" strongly suggests that an element is being obtained from a
container/collection of
> elements. This is how I conceptualize "from module import name": "name"
refers to an object
> INSIDE the module, not the module itself. If I saw
>
> if (match from pattern.search(data)) is not None:
        ...

> I would guess that it is equivalent to
>
> m = next(pattern.search(data))
> if m is not None:
        ...

+1, although unpacking seems to be reasonable `[elem1, *elems] from
contains`.


Now we have

- "expr as name"
- "name := expr"
- "expr -> name"
- "name from expr"

Personally I prefer "as", but I think without a big change of python
Grammar file, it's impossible to avoid parsing "with expr as name" into
"with (expr as name)" because "expr as name" is actually an "expr".
I have mentioned this in previous discussions and it seems it's better to
warn you all again. I don't think people of Python-Dev are willing to
implement a totally new Python compiler.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180415/6db6b95a/attachment-0001.html>


More information about the Python-ideas mailing list