Message410136
This line https://github.com/python/cpython/blob/3d11c1b8b49800c5c4c295953cc3abf577f6065a/Lib/asyncio/windows_events.py#L842 uses `.items()`, but the key seems unsused.
It would be better to use `.values()` there.
1. It is slightly faster, very generic benchmark:
```
import timeit
cache = {i: (i, i + 1, None, f'a{i}') for i in range(1000)}
timeit.timeit('list(cache.items())', number=1000, globals=locals())
# 0.18165644304826856
timeit.timeit('list(cache.values())', number=1000, globals=locals())
# 0.04786261299159378
```
2. It is more readable, because unused variables are not created
And since it does not break anything, I think it is safe to refactor. |
|
Date |
User |
Action |
Args |
2022-01-09 09:11:22 | sobolevn | set | recipients:
+ sobolevn, eric.araujo, asvetlov |
2022-01-09 09:11:22 | sobolevn | set | messageid: <1641719482.54.0.073879595451.issue46310@roundup.psfhosted.org> |
2022-01-09 09:11:22 | sobolevn | link | issue46310 messages |
2022-01-09 09:11:22 | sobolevn | create | |
|