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

> Python's weird ideas of scope

I don't know that I'd call them weird, just the natural result of Python's assignment syntax (tho I suspect that you might call that weird as well). Without specific declaration syntax, it would be somewhere between messy and impossible to differentiate between block and function-level scopes. The only thing I could think of would be the inclusion of a new declaration/assignment operator, like `=:`, that would declare the variable as block scoped, but such a change would be backwards incompatible and I don't believe they're going to do that again.

What would you like it to look like? How would you want it to work?



Many choices for a new operator would not cause backwards incompatibility, as it'd currently be invalid syntax.

However, allowing block scope variables would make the interpreter internals far more complex for dubious benefit.




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

Search: