[Twisted-Python] python properties in twisted don't work

James Y Knight foom at fuhm.net
Thu Dec 18 17:36:14 EST 2008


On Dec 18, 2008, at 3:06 PM, Tristan Seligmann wrote:

> * Alec Flett <alecf at metaweb.com> [2008-12-18 11:03:48 -0800]:
>
>>
>> On Dec 18, 2008, at 6:04 AM, Drew Smathers wrote:
>>
>>> Protocol is an old-style class - doesn't inherit from object - so
>>> property won't work in that context.  This won't be a problem in
>>> python 3 - old-style/new-style classes are consolidated.
>>>
>>
>> Is there any interest in adding 'object' to some of the core classes
>> like Deferred, in a future release of Twisted? It would help with  
>> some
>> debugging/logging (because there's better introspection)
>
> The proble with doing this is that it is a backwards-incompatible  
> change;
> doing this in a way that would comply with Twisted's backwards
> compatibility policy would be somewhat awkward:
>
> http://twistedmatrix.com/trac/wiki/CompatibilityPolicy

The only way this could be done would be to do so in an "opt-in"  
fashion. E.g. something like:
import twisted
twisted.useNewStyleClasses(True)

But even that would be global for a given instantiation of the python  
interpreter which isn't really very good either if you need to mix new- 
style-expecting and old-style-expecting classes.

So it really doesn't esem worth it, given that people can mixin object  
themselves if they desire.

James




More information about the Twisted-Python mailing list