[Python-Dev] assignment expressions: an alternative proposal (original) (raw)
Yury Selivanov yselivanov.ml at gmail.com
Tue Apr 24 11:49:28 EDT 2018
- Previous message (by thread): [Python-Dev] assignment expressions: an alternative proposal
- Next message (by thread): [Python-Dev] assignment expressions: an alternative proposal
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, Apr 24, 2018 at 11:34 AM, Steven D'Aprano <steve at pearwood.info> wrote:
On Tue, Apr 24, 2018 at 11:05:57AM -0400, Yury Selivanov wrote:
Well,
myfunc(a=(b:=foo))
ormyfunc(b:=foo)
are also barely readable to my eye. There's no advantage to using binding-expressions unless you're going to re-use the name you just defined, and that re-use will give you a hint as to what is happening: myfunc(arg, buffer=(buf := [None]*getsize()), size=len(buf))
Again, this is very subjective, but this code would fail my code review :)
Don't you find
buf = [None] * get_size() my_func(arg, buffer=buf, size=len(buf))
to be more readable?
IMHO this example is why we shouldn't implement any form of assignment expressions in Python :)
Yury
- Previous message (by thread): [Python-Dev] assignment expressions: an alternative proposal
- Next message (by thread): [Python-Dev] assignment expressions: an alternative proposal
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]