thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laurens Van Houtven <...@laurensvh.be>
Subject Re: py:twisted not creating new-style classes
Date Mon, 22 Jun 2009 10:26:58 GMT
Cool, thanks, I didn't know that existed :-D

Also, isn't part of the point of newstyle classes that you can just put:
super(ThisClass, self).__init__(self)
everywhere and that your entire inheritance lattice is guaranteed to
work (well, every __init__ will be called at least...)? Or maybe I'm
missing something Thrift-generated code specific, like I said, I don't
know anything about Thrift (but I'm liking it more and more every
passing minute) :-)

Also: does anyone know of any existing open source projects that use
thrift --gen py:twisted,new_style that I could take a look at (mainly
the Twisted bit, really). The generated servicename-remote script is a
big help, but more examples are always nice.


Thanks for the help
Laurens

On Mon, Jun 22, 2009 at 11:57 AM, Terry Jones<terry@jon.es> wrote:
> Hi Laurens
>
>>>>>> "Laurens" == Laurens Van Houtven <lvh@laurensvh.be> writes:
> Laurens> I've noticed that the classes generated by py:twisted aren't
> Laurens> new-style.
>
> Use
>
>  thrift --gen py:twisted,new_style
>
> to get new-style classes. I've been meaning to file a ticket for an
> addition to the class specification, I guess via something like
>
>    struct myclass {
>        1:i32 xxx,
>    } (python.superclass = "otherclass")
>
> that would allow one to specify the parent class. Then you could call
> __init__ in super, and perhaps not generate a __repr__ (to allow the parent
> to determine how instances should be printed), and maybe other things.
>
> Terry
>

Mime
View raw message