Serhiy Storchaka added the comment:
The operator module is rarely used in the stdlib, but if it is used in user
code (mainly with map(), reduce() or like) the performance often is important.
You can use microbenchmarks like following (operator.add is twice faster than
lambda x, y: x + y).
./python -m timeit -s "import operator; a = list(range(10000)); b = a[:]"
-- "list(map(operator.add, a, b))"
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue20186>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com