[Python-3000] PEP 3002: Procedure for Backwards-Incompatible Changes

Terry Reedy tjreedy at udel.edu
Fri Apr 14 00:44:09 CEST 2006


"Steven Bethard" <steven.bethard at gmail.com> wrote in message 
news:d11dcfba0604130907y73d57c14o7929ea405c4ef48b at mail.gmail.com...
> Thus, for any backwards-incompatible change, two things are required:
>
> * An official Python Enhancement Proposal (PEP)
> * Code that can identify pieces of Python 2.X code that may be
>  problematic in Python 3000

I should hope and like it specified that the code is required for final 
acceptance rather than submission.

For some PEPs, triggering a warning will only require matching parsed names 
to the affected name(s).  Example, moving filter from builtins to 
functools.  I should hope that python3warn.py will at least parse the 
target code into tokens and have a dict of trigger_names:message_templates 
(or possible just a set if one template will do) and code something like

if name in changed_names: warn(name, lineno, changed_names[name])

executed for each parsed name.  Then the incremental code change needed is 
a line in the definition of changed_names.

For some simple changes, we can do auto-edits (with programmer okays) 
instead of just warn.  For the movement of filter, the change is either add 
'from functools import filter' at the top or add 'import functools' if not 
there alread and change 'filter' to 'functools.filter'.  So a python3edit 
could be added as a desireable possibility.

(I initially thought filter replacement could be unconditional until I 
remembered the possibility of 'def filter...'.  On the other hand, I have 
the impression that one of pylint/pychecker can detect builtin overrides 
already.)

Terry Jan Reedy





More information about the Python-3000 mailing list