
Feb. 28, 2017
10:07 p.m.
On 28 Feb 2017, at 22:17, Victor Stinner wrote:
I just noticed a module on PyPI to implement this behaviour on Python functions:
Tangential to the main topic, but this module doesn’t enforce positional-only arguments. It allows you enforce keyword-only arguments like on Python 3: >>> from positional import positional >>> @positional(1) ... def replace(old, new): ... ... ... >>> replace(old='a', new='b') >>> replace('a', 'b') Traceback (most recent call last): File "<stdin>", line 1, in <module> File “…/site-packages/positional/__init__.py", line 97, in inner raise TypeError(message) TypeError: replace takes at most 1 positional argument (2 given) Frazer