From Newsgroup: comp.lang.python.announce
*Late* provides decorators and functions to work around the issues that
early binding of default argument values produces in Python.
@latebinding
def f(x: list[Any] = __([])) -> list[Any]:
x.append(1)
return x
assert f() == [1]
assert f() == [1]
assert f() == [1]
https://pypi.org/project/Late/
--
Juancarlo *AƱez*
mailto:
[email protected]
--- Synchronet 3.20a-Linux NewsLink 1.114