Ian Kelly <ian.g.ke...@gmail.com>: > Let's take a different example. > > class Dialog(Window): > > def __init__(self, parent, title, ok_callback): > super().__init__(parent, title) > self._ok_callback = ok_callback > self._ok_button = Button(self, 'Ok') > self._ok_button.bind(self._ok_callback) > > def f(event): > print("Hello world") > > dialog = Dialog(None, "Example", f) > dialog.show() > > Are you suggesting that dialog._ok_callback should be considered a > method of Dialog, despite the fact that the implementation of Dialog > and the implementation of f are entirely unrelated? If so, then I > think that most OOP practitioners would disagree with you.
First, terminology disputes are pointless. No, I would never call f a method of Dialog. I might call it a method of dialog, though. A method is simply a callable attribute: Procedures in object-oriented programming are known as methods <URL: https://en.wikipedia.org/wiki/Object-oriented_programming> (Now, in CLOS, GOOPS etc, methods are not attributes at all, but that's another story.) Marko -- https://mail.python.org/mailman/listinfo/python-list