On Sun, Apr 12, 2015 at 1:15 AM, Steven D'Aprano
On Sat, Apr 11, 2015 at 11:44:23PM +1000, Chris Angelico wrote:
Every document I've ever seen has taken one of two attitudes toward old-style classes. Either they should be considered deprecated, and every class you define should explicitly subclass something; or they're a really cool micro-optimization with a few fancy flexibilities that new-style classes don't have, but which come up only in the most obscure cases.
I wouldn't necessarily believe that classic classes are still faster than new-style classes. I think it was certainly true back in the 2.2 and 2.3 days, but probably not in 2.7. In any case, I'd like to see the benchmarks demonstrating a speed advantage to classic classes before believing that they are an optimization in practice.
Not sure if there's a speed advantage or not, but apparently there's a size advantage: http://lucumr.pocoo.org/2014/8/16/the-python-i-would-like-to-see/ Though the difference doesn't apply to instances - a new-style class instance is marginally smaller than its compatriot - and the difference would be dwarfed by actual content anyway, in a typical program. Hence "micro-optimization". ChrisA