• lime!@feddit.nu
    link
    fedilink
    English
    arrow-up
    6
    ·
    edit-2
    1 day ago

    no, the linked table shows how python also returns the first non-falsey result of an a or b expression rather than just giving a boolean. it’s useful for initialising optional reference args:

    def foo(a: list = None)
        a = a or []
    

    works with and as well.