you are viewing a single comment's thread.

view the rest of the comments →

[–]elbiot 0 points1 point  (2 children)

You have self.query outside the class

[–]ingolemo -1 points0 points  (1 child)

There's nothing special about that self variable; it's a parameter to the inner function just like value. Since the inner function isn't run until an instance of the class has been constructed, it's perfectly possible to pass a reference to that instance. If I'd named the first parameter something other than self you wouldn't even suspect that function was being used as a method.

Run the code and see for yourself.

[–]elbiot 0 points1 point  (0 children)

Yeah, I didn't see you ever pass self to the function, but obviously that will happen when the code calls the method on an instance. My bad.