thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James E. King III (JIRA)" <>
Subject [jira] [Closed] (THRIFT-1088) Thrift library python classes should be new-style classes
Date Sat, 26 Jan 2019 14:51:00 GMT


James E. King III closed THRIFT-1088.
       Resolution: Duplicate
         Assignee: James E. King III
    Fix Version/s: 0.10.0

> Thrift library python classes should be new-style classes
> ---------------------------------------------------------
>                 Key: THRIFT-1088
>                 URL:
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Python - Library
>    Affects Versions: 0.6
>            Reporter: Will Pierce
>            Assignee: James E. King III
>            Priority: Minor
>             Fix For: 0.10.0
>         Attachments: THRIFT-1088_pthon_new_style_classes.patch, THRIFT-1088_python_new_style_classes_v2.patch,,,
> The included python thrift library classes (TType, TProtocolBase, etc...) are all defined
using old-style python class definitions.  This makes it somewhat more difficult to dynamically
deal with instances of those classes at runtime, since the type() builtin doesn't return the
class name.  I don't think there's really any good reason for avoiding using new style classes.
 The typical fear/uncertainty/doubt with new-style classes (since 2001 when they were made
available in python 2.2) is that they are thought to be slower than old-style classes.  I
personally haven't ever found the performance difference between old and new style classes
> Unless there's a compelling reason that Thrift developers want to use old-style classes,
I think it's a more programmer-friendly choice to switch these to new-style classes.  Not
to mention the benefits that new style classes provide, see:

> The following thrift classes don't inherit from the 'object' class, so are old-style
> {noformat}
> % find . -name \*py | xargs grep class | grep -v [.]svn | grep '[a-zA-Z0-9]:$'
> ./src/protocol/ CompactType:
> ./src/protocol/ TCompactProtocolFactory:
> ./src/protocol/ TProtocolBase:
> ./src/protocol/ TProtocolFactory:
> ./src/protocol/ TBinaryProtocolFactory:
> ./src/protocol/ TBinaryProtocolAcceleratedFactory:
> ./src/ TType:
> ./src/ TMessageType:
> ./src/ TProcessor:
> ./src/server/ TServer:
> ./src/server/ Connection:
> ./src/server/ TNonblockingServer:
> ./src/transport/ TTransportBase:
> ./src/transport/ CReadableTransport:
> ./src/transport/ TServerTransportBase:
> ./src/transport/ TTransportFactoryBase:
> ./src/transport/ TBufferedTransportFactory:
> ./src/transport/ TFramedTransportFactory:
> {noformat}
> I'll make changes to my local copy of trunk, run the tests and then attach a patch to
this ticket for evaluation.
> Unless anyone has objections or concerns about switching to new style classes?

This message was sent by Atlassian JIRA

View raw message