Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #57442

Re: Maintaining a backported module

From Ben Finney <ben+python@benfinney.id.au>
Subject Re: Maintaining a backported module
Date 2013-10-24 21:01 +1100
References <5268a818$0$30000$c3e8da3$5496439d@news.astraweb.com> <mailman.1445.1382598011.18130.python-list@python.org> <5268ea9b$0$2838$c3e8da3$76491128@news.astraweb.com>
Newsgroups comp.lang.python
Message-ID <mailman.1462.1382608923.18130.python-list@python.org> (permalink)

Show all headers | View raw


Steven D'Aprano <steve@pearwood.info> writes:

> 1) statistics.py in the standard library, which is written for 
>    Python 3.3/3.4 only, and should be as clean as possible;
>
> 2) a backport of it, on PyPI, which will support older Pythons, and
>    may be slower/uglier if need be.
>
> My problem is not supporting 2.7 and 3.4 in the one code base. My
> problem is, how do I prevent #1 and #2 from gradually diverging?

Generate one of them automatically from the other. My recommendation
would be to edit only the code written for Python 3.4, have a
fully-automatic generator for the code targeting Python 2.7, and ignore
all earlier versions.

How does the “3to2” tool <URL:http://pypi.python.org/pypi/3to2/> fare
with converting your code?

> The easy answer is "unit tests", but the unit tests for 1) are in the
> std lib and target 3.4, while the unit tests for 2) will be on PyPI
> and won't. So how do I keep the unit tests from diverging?

Again, I'd recommend you generate the Python 2 code automatically from
the actively-maintained Python 3 code.

-- 
 \     “Beware of and eschew pompous prolixity.” —Charles A. Beardsley |
  `\                                                                   |
_o__)                                                                  |
Ben Finney

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Maintaining a backported module Steven D'Aprano <steve@pearwood.info> - 2013-10-24 04:54 +0000
  Re: Maintaining a backported module Ben Finney <ben+python@benfinney.id.au> - 2013-10-24 16:09 +1100
    Re: Maintaining a backported module Metallicow <metaliobovinus@gmail.com> - 2013-10-23 22:46 -0700
      Re: Maintaining a backported module Metallicow <metaliobovinus@gmail.com> - 2013-10-30 03:32 -0700
  Re: Maintaining a backported module Paul Rubin <no.email@nospam.invalid> - 2013-10-23 22:38 -0700
  Re: Maintaining a backported module Ethan Furman <ethan@stoneleaf.us> - 2013-10-23 23:30 -0700
  Re: Maintaining a backported module Ben Finney <ben+python@benfinney.id.au> - 2013-10-24 17:59 +1100
    Re: Maintaining a backported module Steven D'Aprano <steve@pearwood.info> - 2013-10-24 09:38 +0000
      Re: Maintaining a backported module Ben Finney <ben+python@benfinney.id.au> - 2013-10-24 21:01 +1100
  Re: Maintaining a backported module Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-10-24 09:00 +0200
  Re: Maintaining a backported module Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-10-24 09:37 +0100
  Re: Maintaining a backported module Ned Batchelder <ned@nedbatchelder.com> - 2013-10-24 06:36 -0400
    Re: Maintaining a backported module Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-10-24 11:46 +0000
      Re: Maintaining a backported module rusi <rustompmody@gmail.com> - 2013-10-24 05:25 -0700
      Re: Maintaining a backported module Ned Batchelder <ned@nedbatchelder.com> - 2013-10-24 13:46 -0400
      Re: Maintaining a backported module Terry Reedy <tjreedy@udel.edu> - 2013-10-24 16:37 -0400
      Python Coverage: testing a program (was: Maintaining a backported module) Ben Finney <ben+python@benfinney.id.au> - 2013-10-25 07:54 +1100
      Re: Python Coverage: testing a program Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-10-24 22:55 +0100
      Re: Python Coverage: testing a program Terry Reedy <tjreedy@udel.edu> - 2013-10-24 18:36 -0400
      Re: Python Coverage: testing a program Ethan Furman <ethan@stoneleaf.us> - 2013-10-24 15:28 -0700
      Re: Python Coverage: testing a program Ben Finney <ben+python@benfinney.id.au> - 2013-10-25 10:27 +1100
      Re: Python Coverage: testing a program Ben Finney <ben+python@benfinney.id.au> - 2013-10-25 10:30 +1100
      Re: Python Coverage: testing a program Ned Batchelder <ned@nedbatchelder.com> - 2013-10-24 19:53 -0400
      Re: Python Coverage: testing a program Terry Reedy <tjreedy@udel.edu> - 2013-10-24 19:55 -0400
      Re: Maintaining a backported module Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-10-25 08:49 +0100
  Re: Maintaining a backported module Christian Heimes <christian@python.org> - 2013-10-24 12:47 +0200
  Re: Maintaining a backported module Ethan Furman <ethan@stoneleaf.us> - 2013-10-24 12:42 -0700

csiph-web