Hi, I recently realised one can use immutable default arguments to avoid a chain of:

def append_to(element, to=None):
    if to is None:
        to = []

at the beginning of each function with default argument for set, list, or dict.

  • logging_strict@programming.dev
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    21 days ago

    Upvote for the sanity check.

    As the OP mentioned, this is a proposed/draft feature that may or may not ever happen.

    With these kinda posts, should start a betting pool. To put money down on whether this feature sees the light of day within an agreed upon fixed time frame.