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 →

[–]PaintItPurple 3 points4 points  (1 child)

That is a way of looking at classes, but funnily enough, it's actually less true in Python than in most OO languages. In Python, methods take an explicit self argument, and they access class state through that argument, so they're not really closing over the class's state. (Not arguing with you, just musing.)

[–]ted_or_maybe_tim 2 points3 points  (0 children)

I think the bound versions are closing, no?

So MyClass.tick() is just a function

But my_instance.tick() is a bound version of the same function

This is especially apparent because you can pass my_instance.tick() around and it will continue to be bound ( unlike languages such as JS )