[issue44123] make function parameter sentinel value true singletons
Tal Einat
report at bugs.python.org
Sat May 15 15:23:47 EDT 2021
Tal Einat <taleinat+python at gmail.com> added the comment:
> And what you need is just to not pass to the wrapped function arguments which were not passed to wrapper. *args and **kwargs do not contain arguments which were not passed.
It's common for wrapper functions to mirror the defaults of the wrapped functions and pass those along... A quick search brings up an example from dataclasses where sentinel values are passed as arguments to a wrapped callable[1].
I concede that issues with pickling such values are very unlikely. I stumbled upon such an issue once and it was difficult to debug, but that was a very unusual circumstance.
Still, it's a bit surprising that we have public facing values in stdlib modules which don't behave as one would expect with regard to pickling. This is why I created this
It seems that I should have marked this as "enhancement" rather than the default of "behavior", though, since I meant this to be an improvement on the current situation, rather then assert the current situation is "broken".
[1] https://github.com/python/cpython/blob/c10c2ec7a0e06975e8010c56c9c3270f8ea322ec/Lib/dataclasses.py#L346
----------
type: behavior -> enhancement
versions: -Python 3.10
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44123>
_______________________________________
More information about the Python-bugs-list
mailing list