News for hackers. Stuff that matters.
Re:Upcoming Python features brought to you by Python Enhance... by ryanianian on Monday February 14, 2022 @10:30AM (#30333167)
I've never really seen arg1 depend on arg0 like that in Python.

However this comes up a lot for new engineers during programming interviews. It's very common to see recursive algos use empty lists as default/start-case args:

    def traverse(graph, seen_so_far=[]):  # Incorrect
        ....
        seen_so_far.append(node)
Subsequent calls to `traverse` will have state accumulated from earlier calls. The right solution is:

    def traverse(graph, seen_so_far=None):
        if not seen_so_far:
            seen_so_far = []
        .....
This isn't obvious if you're new to Python. This PEP makes this (arguably) clearer with:

    def traverse(graph, seen_so_far=>[]):
Re:Upcoming Python features brought to you by Python Enhance... by usrbinbash on Monday February 14, 2022 @12:06PM (#30334463)
But how does => make it more obvious to someone who's new to python?
Re:Upcoming Python features brought to you by Python Enhance... by dragonwriter on Monday February 14, 2022 @12:11PM (#30334559)
> This PEP makes this (arguably) clearer

It's more concise when you are familiar with it, and it improves introspection and dev tooling when functions use it, but it is not fundamentally clearer.