[Python-Dev] [Python-3000] Warning for 2.6 and greater

Guido van Rossum guido at python.org
Fri Jan 12 20:24:47 CET 2007


On 1/12/07, Steven Bethard <steven.bethard at gmail.com> wrote:
> Yeah, when this was talked about last time, I wrote PEP 3002 which
> requests exactly this:
>
>     http://www.python.org/dev/peps/pep-3002/
>
> It basically proposes that all backwards-incompatible changes be
> discussed in a PEP somewhere, and that code like Anthony's be added to
> 2.X to ease the transition.  Originally, it has proposed just a
> utility like Guido's 2to3 but Guido himself suggested something like
> Anthony's approach:
>
>     http://mail.python.org/pipermail/python-3000/2006-April/001444.html

To complement 2to3, not to replace it.

> I'm planning to update the PEP with any new conclusions arrived at in
> this thread.

I think that now the 2to3 tool is a reality, its limitations should
perhaps be taken into account.

For example, I don't believe it is realistic to expect it to do
semantic analysis, which means that for example it can't be expected
to know whether 'd' in 'd.keys()' is a dict or something else.

Also, in 'k = d.keys()' it can't be expected to analyze how k is used
later on; to be safe, it will translate all occurrences of d.keys()
into list(d.keys()) which is known to work (and won't be slower than
the original code either).

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


More information about the Python-Dev mailing list