New submission from Marek Kubica <ma...@xivilization.net>: When calling operators from the ``operator``-module, they refuse to accept keyword arguments:
operator.add(a=1, b=2) TypeError: add() takes no keyword arguments Operators with keyword arguments are important when one wants to create partial functions with non-positional arguments. Take for example ``operator.mod`` where the order of the arguments matters: This works: map(lambda x: x % 2, range(5)) This does not work, since ``operator.mod`` does not support keyword arguments: map(functools.partial(operator.mod, b=2), range(5)) So there are two solutions: define one's own add(), mod(), contains() etc. but then the ``operator`` module is rather useless or make them accept keyword arguments. With ``partial`` in the Stdlib this solution would be a whole lot nicer. ---------- components: Library (Lib) messages: 84181 nosy: leonidas severity: normal status: open title: Operators in operator module don't work with keyword arguments type: feature request _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue5567> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com