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.
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:
Subsequent calls to `traverse` will have state accumulated from earlier calls. The right solution is: This isn't obvious if you're new to Python. This PEP makes this (arguably) clearer with: