4 ms·
Wel, too bad they did not implement this with python 3, and actually gave some meaning to the type annotations… I mean def dprod(l0: list[int], l1: list[int]):
by guyzmo 10y ago
Wel, too bad they did not implement this with python 3, and actually gave some meaning to the type annotations… I mean
def dprod(l0: list[int], l1: list[int]):
return sum(x * y for x, y in zip(l0, l1))
Wouldn't it be much nicer?
- srean 10y agoTo be brutally honest, they probably couldn't give a flying fuck, I couldn't when I tried. (sorry) To the number crunchers, Python 3.* offers no compelling reason to move (except for threats, "you are on your own now, 2.7.* will not get updates"). I see two compelling advantages that 3.* offers (i) better abstractions for asynchrony (ii) UTF strings (that exacts a cost even if you don't need them). If you don't need these two there I see no technical reason to move (political/social reasons yes, technical not really).
- module0000 10y agoFor what it's worth, Python 3 does offer at least 1 compelling reason to move. Multiprocessing lib in python 3 is significantly faster than python 2. My use case is spawning 30-35 worker processes managed by a pool, and recycling them after 5 workloads pass through. The switch from 2.x to 3.x without any code changes, increased my throughput ~150%. Your mileage may vary. edit: typo
- srean 10y agoOh! thanks for this, I did not know.