On Oct 25, 2009, at 1:50 AM, James Y Knight wrote:

On Oct 25, 2009, at 1:38 AM, Glyph Lefkowitz wrote:
What do you do? Well, the obvious upgrade path here is to make a class which (A) inherits from "Library" to get Twisted functionality and (B) inherits from "object" to get new-style- ness. So you go ahead and write:

# 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?)

_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to