News for hackers. Stuff that matters.
Re:More intuitive partial function application in Python by akdor1154 on Sunday February 20, 2022 @08:07PM (#30410860)
I was gonna say cool for FP guys but alien to the Python world, but then i saw the f(..., x=1) syntax and decided you're a genius. Really nice idea.

In practice i worry about static checkers and IDE param hints though, how have you fared with these?

Not your fault at all, but mypy/pyright have very poor support for wrappers like this, and in IDEs it's common for their arg hints to devolve to a copout (args, kwargs) as well.

Re:More intuitive partial function application in Python by heavyset_go on Sunday February 20, 2022 @09:59PM (#30411479)
> Not your fault at all, but mypy/pyright have very poor support for wrappers like this, and in IDEs it's common for their arg hints to devolve to a copout (args, kwargs) as well.

You might be able to annotate it accurately with generics, ParamSpec and Concatenate[1].

[1] https://www.python.org/dev/peps/pep-0612/

Re:More intuitive partial function application in Python by cgrimm1994 on Monday February 21, 2022 @09:27AM (#30416204)
I'll give this a look.
Re:More intuitive partial function application in Python by cgrimm1994 on Monday February 21, 2022 @09:27AM (#30416201)
High praise :-) I'm glad you like it! I don't know much about static checks / param hinting. TBH, I coded this up because I wanted to imagine how functions should work in Python as more of a fun exercise.

Accordingly there are a lot of things I have to do to make better_partial a strong tool for the community. I'll probably have time to work on the project again later in the week.