Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I agree that Python would benefit from separating mutation and assignment.

Especially when you are dealing with nested functions. You'd get around the whole need for 'global' and 'nonlocal' declarations. (Though your linter might still ask you for them for clarity.)

As a minimal syntax change, I would propose using perhaps = for introduction of a variable (the common case) and := for an explicit mutation of an existing variable.

But you could also use `let . = ..` and `. = ..` like Rust does.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: