Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A better functools (more signature-preserving than current impl, and with more features) #2

Open
smarie opened this issue Nov 20, 2019 · 0 comments
Labels

Comments

@smarie
Copy link
Owner

smarie commented Nov 20, 2019

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 ?

Related stackoverflow posts:

@smarie 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
@smarie smarie added the makefun label Sep 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant