Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=python.org; s=200901; t=1382611672; bh=w6M5AEJbuR0r26h6/8GOu8waBcMPd0T3LMoi6v89HgI=; h=Date:From:To:Subject:References:In-Reply-To:From; b=liLxyIyIj3Bvw2JgmAOt/pwvHI4HYxpkL4Pybyw/I1TqvCKRRqlvUZIta3Y4CY4v9 zKvwhHJ9RYEqk2PbMNLhMAuvqPELyqveMjfKr4erlzgLgVdwQ1xq+tVuIIBamTP/C9 RP7PFaca8bhpl4vBA4zGzx/dmZrlsoE9ViROEnQI= Date: Thu, 24 Oct 2013 12:47:50 +0200 From: Christian Heimes User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: Steven D'Aprano , python list Subject: Re: Maintaining a backported module References: <5268a818$0$30000$c3e8da3$5496439d@news.astraweb.com> In-Reply-To: <5268a818$0$30000$c3e8da3$5496439d@news.astraweb.com> X-Enigmail-Version: 1.5.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 53 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1382611674 news.xs4all.nl 15958 [2001:888:2000:d::a6]:34913 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:57446 Am 24.10.2013 06:54, schrieb Steven D'Aprano: > As some of you are aware, I have a module accepted into the standard > library: > > http://docs.python.org/3.4/library/statistics.html > > I'm now at the point where I wish to backport this module to support > versions of Python back to 3.1 at least and possibly 2.7, and put it up > on PyPI. > > I'm looking for advice on best practices for doing so. Any suggestions > for managing bug fixes and enhancements to two separate code-bases > without them diverging too much? Hi Steven, your module doesn't process text and doesn't use any fancy 3.x features except raise from None. It should be just a matter of an hour or two to port and package your code. 1) Add from __future__ import divisision import sys as _sys if _sys.version_info[0] == 2: range = xrange to the top of your files to use 3.x integer division and generator range 2) Remove from None in the exception handling code 3) Perhaps for 2.7 use iteritems in _sum() sorted(partials.items()) For testing under 2.6 you can use the unittest2 package. It offers all the nice new features like assertIsInstance() and assertIn(). I highly recommand tox + py.test for testing. You can test your package with all versions of Python with just one command. We already have a namespace for backports that you can use: backports. :) Feel free to contact me via mail in #python-dev if you have any questions. Christian