From dev-return-55225-archive-asf-public=cust-asf.ponee.io@thrift.apache.org Sat Jan 26 15:51:06 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 5460D180609 for ; Sat, 26 Jan 2019 15:51:06 +0100 (CET) Received: (qmail 89376 invoked by uid 500); 26 Jan 2019 14:51:05 -0000 Mailing-List: contact dev-help@thrift.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@thrift.apache.org Delivered-To: mailing list dev@thrift.apache.org Received: (qmail 89365 invoked by uid 99); 26 Jan 2019 14:51:05 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 26 Jan 2019 14:51:05 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 1ACCF1806D2 for ; Sat, 26 Jan 2019 14:51:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -110.301 X-Spam-Level: X-Spam-Status: No, score=-110.301 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id Y7u36vauv3T6 for ; Sat, 26 Jan 2019 14:51:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 1D8375F57C for ; Sat, 26 Jan 2019 14:51:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 88B33E006D for ; Sat, 26 Jan 2019 14:51:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 409B024322 for ; Sat, 26 Jan 2019 14:51:00 +0000 (UTC) Date: Sat, 26 Jan 2019 14:51:00 +0000 (UTC) From: "James E. King III (JIRA)" To: dev@thrift.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Closed] (THRIFT-1088) Thrift library python classes should be new-style classes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/THRIFT-1088?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] 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: https://issues.apache.org/jira/browse/THRIFT-1088 > 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, perftest.py, runtest.sh, runtest2.sh > > > 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 to > 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: http://realmike.org/blog/2010/07/18/introduction-to-new-style-classes-in-python/ > The following thrift classes don't inherit from the 'object' class, so are old-style classes: > {noformat} > % find . -name \*py | xargs grep class | grep -v [.]svn | grep '[a-zA-Z0-9]:$' > ./src/protocol/TCompactProtocol.py:class CompactType: > ./src/protocol/TCompactProtocol.py:class TCompactProtocolFactory: > ./src/protocol/TProtocol.py:class TProtocolBase: > ./src/protocol/TProtocol.py:class TProtocolFactory: > ./src/protocol/TBinaryProtocol.py:class TBinaryProtocolFactory: > ./src/protocol/TBinaryProtocol.py:class TBinaryProtocolAcceleratedFactory: > ./src/Thrift.py:class TType: > ./src/Thrift.py:class TMessageType: > ./src/Thrift.py:class TProcessor: > ./src/server/TServer.py:class TServer: > ./src/server/TNonblockingServer.py:class Connection: > ./src/server/TNonblockingServer.py:class TNonblockingServer: > ./src/transport/TTransport.py:class TTransportBase: > ./src/transport/TTransport.py:class CReadableTransport: > ./src/transport/TTransport.py:class TServerTransportBase: > ./src/transport/TTransport.py:class TTransportFactoryBase: > ./src/transport/TTransport.py:class TBufferedTransportFactory: > ./src/transport/TTransport.py:class 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 (v7.6.3#76005)