On Thu, Dec 02, 2021 at 08:29:58AM +0000, Paul Moore wrote:
> 1. It's hard (if not impossible) to wrap functions that use late-bound
> defaults.
I don't understand that argument.
We can implement late-bound defaults right now, using the usual sentinel
jiggery-pokery.
def func(spam, eggs, cheese=None, aardvark=42):
if cheese is None: ... # You know the drill.
We can wrap functions like this. You don't generally even care what the
sentinel is. A typical wrapper function looks something like this:
@functools.wraps(func)
def inner(*args, **kwargs):
# wrapper implementation
func(*args, **kwargs)
with appropriate pre-processing or post-processing as needed.
Why would argument unpacking to call the wrapped function stop working?
--
Steve
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/AHPM6SKTBJZLQBLUYULFPS2K77NJ2LAR/
Code of Conduct: http://python.org/psf/codeofconduct/