[Python-Dev] Call for prudence about PEP-572
Mike Miller
python-dev at mgmiller.net
Sat Jul 7 23:09:08 EDT 2018
On 2018-07-07 06:09, Giampaolo Rodola' wrote:
> I initially found myself disliking the idea as a whole but
> https://github.com/python/cpython/pull/8122 made me (and others) reconsider it
> quite a bit (see: https://twitter.com/grodola/status/1015251302350245888).
> PR-8122 clearly shows an improvement in expressiveness and compactness (many
> folks argue this is too much)
One of the requirements from the PEP (informing its design) is that there would
be a significant need and opportunities to use it with multiple and/or compound
conditions.
While it may be a function of Victor's choices, from my reading of the pull
request the vast majority of the improved lines has but a single, simple
condition such as:
while (data := f.readframes(1024)):
I believe Giampaolo has a good point. These expressions are useful, however
don't seem to have much value outside these examples.
On the subject on imagining how they would be used, suppose we could look at
JavaScript or other expression-oriented languages for best practices. Didn't
find many admonitions however, other than keep it simple:
https://stackoverflow.com/q/9726496/450917
-Mike
More information about the Python-Dev
mailing list