Re: [Python-Dev] The new and improved PEP 572, same great taste with 75% less complexity!

2018年4月26日 09:42:45 -0700

[Guido]
> Maybe the order for d[k] = v should also be reconsidered?
There's certainly code in the wild relying on the order "v, then d,
then k", because that's just how assignment statements have always
worked (dicts or not). I'd rather change the dict comprehension code,
because I think the analogy to what `d[k] = v` does is weak. I
expect:
 {f(): g() for _ in [1]|
to do the same as
 {f(): g()}
The former currently evaluates g() first; the latter f(). Since I
also expect both of those to do the same as
 dict((f(), g()) for _ in [1])
f() has to win ;-)
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to