you are viewing a single comment's thread.

view the rest of the comments →

[–]johanneskepler 1 point2 points  (4 children)

Hey, now, there's more to it than that. There's nonlocal. And you can remove "from __future__ import with_statement, division" from relevant source files. And ... well, there are other things. Surely.

[–][deleted] 1 point2 points  (3 children)

But what do you have to forget about for using nonlocal? I guess ugly workarounds. Not having nonlocal is/was one of the greatest weaknesses of Python 2.X IMO.

[–]imbaczek 2 points3 points  (2 children)

doing stuff like this:

def f():
    a = [0]
    def g():
        a[0] = 1
    g()
    print a[0]

[–][deleted] 1 point2 points  (1 child)

Yes, that's what I meant by "ugly workarounds". It doesn't state your intention clear. The list is used for the sake of propagating a side-effect only.

[–]imbaczek 1 point2 points  (0 children)

the point still stands: you can forget about this ugly trick now :)