>In Python 3, old-style classes are gone. Even in Python 2, they're >discouraged.
This suggests that old-style classes are still used, even in Python 3, doesn't it? albertjan@debian:~$ python3.5 Python 3.5.0 (default, Apr 13 2016, 20:39:27) [GCC 4.9.2] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import re, inspect >>> re.findall("class.+:", inspect.getsource(tkinter)) ['class Event:', 'class Variable:', 'class StringVar(Variable):', 'class IntVar(Variable):', 'class DoubleVar(Variable):', 'class BooleanVar(Variable):', 'class Misc:', 'className):', 'class(self):', 'class(self, className, sequence=None, func=None, add=None):', 'class(self, className, sequence):', 'class CallWrapper:', 'class XView:', 'class YView:', 'class Wm:', 'class Tk(Misc, Wm):', 'className):', 'class_tcl):', 'class_py):', "className='Tk', useTk=0):", 'class Pack:', 'class Place:', 'class Grid:', 'class BaseWidget(Misc):', 'classes:', 'classes:', 'class Widget(BaseWidget, Pack, Place, Grid):', 'class Toplevel(BaseWidget, Wm):', 'class Button(Widget):', 'class Canvas(Widget, XView, YView):', 'class Checkbutton(Widget):', 'class Entry(Widget, XView):', 'class Frame(Widget):', "class_' in cnf:", "class' in cnf:", 'class Label(Widget):', 'class Listbox(Widget, XView, YView):', 'class Menu(Widget):', 'class Menubutton(Widget):', 'class Message(Widget):', 'class Radiobutton(Widget): ', 'class Scale(Widget):', 'class Scrollbar(Widget):', 'class Text(Widget, XView, YView):', 'class _setit:', 'class OptionMenu(Menubutton):', 'class Image:', 'class PhotoImage(Image):', 'class BitmapImage(Image):', 'class Spinbox(Widget, XView):', 'class LabelFrame(Widget):', 'class PanedWindow(Widget):'] I sometimes want to use the @property decorator in classes that inherit from e.g. tkinter.Frame. The getter then works, but the setter fails without any sign. So I then also inherit from object, as in class WickedFrame(tkinter.frame, object): @property def foo(self): return "foo" @foo.setter def foo(self, value): print("setter called") I do this in Python 2.7. Is this the recommended approach? I also like the fact that I can use super() that way. Thanks! Albert-Jan _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor