[Python-Dev] The new and improved PEP 572, same great taste with 75% less complexity! (original) (raw)
Tim Peters tim.peters at gmail.com
Thu Apr 26 12:39:47 EDT 2018
- Previous message (by thread): [Python-Dev] The new and improved PEP 572, same great taste with 75% less complexity!
- Next message (by thread): [Python-Dev] The new and improved PEP 572, same great taste with 75% less complexity!
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[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 ;-)
- Previous message (by thread): [Python-Dev] The new and improved PEP 572, same great taste with 75% less complexity!
- Next message (by thread): [Python-Dev] The new and improved PEP 572, same great taste with 75% less complexity!
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]