[Python-Dev] PEP 572: Assignment Expressions

Sven R. Kunze srkunze at mail.de
Mon Apr 23 16:35:39 EDT 2018


On 23.04.2018 19:31, Tim Peters wrote:
> Surely you're joking.  This is math.gcd(), which is expensive for
> multi-thousand bit integers, and the interpreter knows nothing about
> it.  Adding a cache of _any_ kind (LRU or otherwise) would make it
> even slower.
Alright, if that problem is just about performance, then there must be a 
better way to resolve it rather than inventing a new syntax. Btw. 
storing the result in a local var is also a cache IMHO. And if gcd is 
immutable, I think Python can do a great job here of optimizing.

Anyway, your example is the best one I've seen so far.



More information about the Python-Dev mailing list