[Python-announce] Late 1.0.0 - late bound arguments

Juancarlo Añez <[email protected]> Sat, 11 Nov 2023 14:43:22 -0400
Newsgroups gmane.comp.python.announce
Message-ID <CAN1YFWuwWLbh1=Ug3b7diPTkK3YuX5o-ApEDz9W_ttNLsLAJxg@mail.gmail.com>
*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]
_______________________________________________
Python-announce-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-announce-list.python.org/
Member address: [email protected]