__name__ for partial functions

Sept. 7, 2021
11:49 a.m.
functools introduces partial function. As I can see from the implementation, partial functions are instance of `partial` class, and that __call__ is used to "emulate" a function call. On the other hand I guess people usually treat those as ordinary functions. The thing here is that for functions people expect to see the __name__ attribute defined and it can be useful in many cases. Why partial does not have a __name__ property and why is it not a good idea to add one?

September 2021
6:10 p.m.
I'm not sure what you're proposing. What should its `__name__` be set to? If you have a value you want its `__name__` to be, you can just set it yourself.
1387
Age (days ago)
1387
Last active (days ago)
1 comments
2 participants
participants (2)
-
Henry Harutyunyan
-
Kevin Mills