Make $ a valid identifier and a singleton

Make $ a valid identifier and a singleton. $ is a useful placeholder in []. Possible function partial syntax: def foo(x, y): print(x, y) partialized = foo[$, 10] partialized(5) # => 5 10

I used "..." in my lib to do that : from funcoperators import bracket @bracket def foo(x, y): print(x, y) partialized = foo[..., 10] partialized(5) https://pypi.org/project/funcoperators/ Le dim. 23 juin 2019 à 21:34, James Lu <jamtlu@gmail.com> a écrit :

On Sun, Jun 23, 2019 at 03:22:37PM -0400, James Lu wrote:
I don't think that creating partial functions is important enough to: 1. make partial functions a built-in language feature; 2. using syntax (square brackets); 3. and require a new built-in singleton. I think that functools.partial is missing two features: - the ability to close over positional parameters from the right, rather than the left; - the ability to skip parameters. The first could be solved with a "rpartial" function, and the second by using ellipsis ... as a placeholder, or a named constant in the functools module. -- Steven

I used "..." in my lib to do that : from funcoperators import bracket @bracket def foo(x, y): print(x, y) partialized = foo[..., 10] partialized(5) https://pypi.org/project/funcoperators/ Le dim. 23 juin 2019 à 21:34, James Lu <jamtlu@gmail.com> a écrit :

On Sun, Jun 23, 2019 at 03:22:37PM -0400, James Lu wrote:
I don't think that creating partial functions is important enough to: 1. make partial functions a built-in language feature; 2. using syntax (square brackets); 3. and require a new built-in singleton. I think that functools.partial is missing two features: - the ability to close over positional parameters from the right, rather than the left; - the ability to skip parameters. The first could be solved with a "rpartial" function, and the second by using ellipsis ... as a placeholder, or a named constant in the functools module. -- Steven
participants (4)
-
Andrew Barnert
-
James Lu
-
Robert Vanden Eynde
-
Steven D'Aprano