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

Guido van Rossum guido at python.org
Tue May 2 00:25:35 CEST 2006


On 4/29/06, Steven Bethard <steven.bethard at gmail.com> wrote:
> On 4/27/06, Guido van Rossum <guido at python.org> wrote:
> > I just read PEP 3002 and while I like most of what I see (thanks
> > Steven Bethard!) there's one section that stands out as problematic.
> [snip]
> > Rather than a version of Python
> > 3000, I suggest to add such warning code to Python 2.x, and not as a
> > branch, but as a permanent feature (that is however only enabled by a
> > command-line flag).
>
> Yes, I think it definitely makes more sense to make the modifications
> on 2.x.  I was hesitant to require integrating it into the main-line
> Python 2.x code because I was worried about affecting performance.
> But of course with a command-line flag, that point is moot.  So
> basically python3warn.py could be become "python -SOME_OPTION" where
> SOME_OPTION would enable all the Python 3.0 checks.
>
> So I guess the question then is what the option should enable.  Should
> it try to implement the Python 3.0 behavior?  Or should it just warn
> when the behavior is changed?  The former requires much more Python
> 3.0 code to be back-ported to Python 2.X, but would presumably give
> much better error reporting.  I'd love to require that, but I'm afraid
> of the work it would take.

It should continue to use the 2.x semantics to the greatest extent
possible, while issueing warnings about any constructs whose semantics
will change in 3.0.

I have a fairly elaborate example in mind: with this new flag,
dict.keys() should return a subclass of list which behaves exactly
like list except that it issues a warning whenever you use any method
other than __iter__(). This should be transparent except to the most
demanding code (the subclass could theoretically cause programs to
behave differently but in practice I doubt it will change much) and
should catch any code that uses the result of keys() other than to
loop over it; at the same time it will not complain about code that
simply assigns keys() to a variable and later (perhaps in a different
function) loops over that variable.

> P.S. I have commit access to the PEPs now, so I can update PEP 3002
> with whatever we decide.

Cool. I can definitely use help keeping all the docs uptodate!

--
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list