On May 26, 9:55 pm, Carl Banks <pavlovevide...@gmail.com> wrote: > I don't want to sound to pessimistic about it, I really wouldn't mind > a metaclass that makes slots more normal; but you have work to do.
Just as a minor followup, I'll mention that slots and inheritance have some issues that aren't going to be resolvable to everyone's satisfaction, and that's another reason why I don't think slots should be accessible by default. For instance, some might assume that deriving from a class with slots automatically grants the derived class the same optimization that the base class has. Others will not even consider that the base class has slots and will assume that their derived class has dynamic attributes like most other Python classes. Who's right? I'd go with the former, for the same reason you gave, but the latter is not unreasonable. type does the latter. The best answer might be to always insist on an explicit declaration one way or another, but that makes it prone to other problems like forward compatibility issues. Point is, it's not a simple thing. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list