[Twisted-Python] Phasing out old-style classes

Kelly k.kelly.gordon at gmail.com
Tue Oct 27 04:35:22 EDT 2009

On Sun, Oct 25, 2009 at 5:32 PM, Glyph Lefkowitz
<glyph at twistedmatrix.com> wrote:
> On Oct 25, 2009, at 1:50 AM, James Y Knight wrote:
>> On Oct 25, 2009, at 1:38 AM, Glyph Lefkowitz wrote:
>>> # in your application
>>> class Application(object, Library): pass
>> Maybe the answer "why not" is obvious and I should already know it, but
>> wouldn't it be more obvious to write:
>> class Application(Library, object): pass
>> instead. That at least has the advantage of not blowing up if Library later
>> becomes newstyle, right?
> Huh.  You may have just pointed out that I misunderstand the algorithm used
> to generate that error.  I thought that certain other hierarchies in cases
> more complex than the trivial one I presented would also give you that error
> if something became new-style in the middle, but I can't seem to generate
> any hierarchies that cause a problem.  Is it really this simple?  Always put
> 'object' at the *end* of your bases-list to declare the intention "I want to
> be new-style" and you'll be OK?  (If so, why is that?)

More information about the Twisted-Python mailing list