You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
functools is a great module to manipulate functions. However the created functions are not user-friendly :
functools.partial does not provide user-friendly name, help/signature, and docstring
functools.wraps does not truly preserve signature. See details here
Besides there is no counterpart to partial (adding parameters). Nor is there any user-friendly way to generalize to any signature modification or dynamic method creation.
I created makefun to cover all of these issues. I relied on dynamic code compilation (the trick that decorator uses). But it is probably less efficient than embedding it in the python framework itself. So a PEP would probably be useful here, what do you think ?
The text was updated successfully, but these errors were encountered:
smarie
changed the title
[makefun] a better functools (more signature-preserving, and with more features)
A better functools (more signature-preserving than current impl, and with more features)
Sep 7, 2020
functools
is a great module to manipulate functions. However the created functions are not user-friendly :functools.partial
does not provide user-friendly name, help/signature, and docstringfunctools.wraps
does not truly preserve signature. See details hereBesides there is no counterpart to partial (adding parameters). Nor is there any user-friendly way to generalize to any signature modification or dynamic method creation.
I created
makefun
to cover all of these issues. I relied on dynamic code compilation (the trick thatdecorator
uses). But it is probably less efficient than embedding it in the python framework itself. So a PEP would probably be useful here, what do you think ?Related stackoverflow posts:
The text was updated successfully, but these errors were encountered: