2 ms·
>which you have to do because of the totally insane and unintuitive fact that all invocations of a Python function share the same parameter I think it does mak
by meowface 6y ago
>which you have to do because of the totally insane and unintuitive fact that all invocations of a Python function share the same parameter
I think it does make sense if you consider the function signature an expression scoped one level above the function definition. I agree it's initially not intuitive, and it's tripped me up a few times before as a beginner, like probably most other beginners.
As a more experienced Python developer, I think I'd actually now find it unintuitive if they changed it, due to everything I've internalized about Python scope, values, assignment, expressions, etc. Same for always requiring "self" as the first method argument. Overall, I'd prefer the changed versions, but I think they (or someone else) would basically need to make a whole new spiritual successor language.