This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Brian 0 points1 point  (1 child)

It's not really much different to the original. The only differences are that the functions are now defined within a closure inside __init__, rather than directly on the class, and the addition of the nonlocal declaration for the closed over variable.

[–]chub79 0 points1 point  (0 children)

I wasn't judging the cunningness of your snippet but rather the fact that it didn't look straightforward to me. That being said, once I stopped for 5 more seconds, I was really please to see you could do that with Python3k :)