Sunday, March 22, 2009

What awesome feature would you like 2to3 to have?

I'm asking because it's that time of year again where Google pays college students to work on opensource projects. Since Python 3.x is such an important issue in the Python community, the PSF organizers have decided emphasize projects related to 2to3. So far, I've been asked by a few interested students for ideas, and I didn't have many, so I thought I'd ask the users of 2to3. What killer features do you want to see in 2to3?

4 comments:

Anonymous said...

This applies more to windows than to other platforms, but if 2to3 identifies the use of a binary module, it would reverse engineer the binary to create an v3 binary that acts as a shim to drive the v2 binary. This would be of great use to the majority of Windows users who don't have access to the right version of the build chain and who aren't C programmers. In addition this allows the salvaging of a large number of orphaned modules that aren't actively maintained because they are good enough.

regebro said...

A set of fixers that helps for 2.6 compatibility. Sticking in from __future__ imports when needed for example. That would be nice.

ajaksu said...

Maybe support for fixers that implement different alternatives, to be chosen interactively or set from a command line option? Instead of guessing user intent, ask? :)

mike bayer said...

I've mentioned this before...preprocessor support. I tried adding this in and the architecture of 2to3 makes it as difficult as possible to add.

What's preprocessor support ? We're doing it like this:

### PY3K
-some py3k only code-
### END PY3K

### PY2K
- some py2k only code-
### END PY2K

But there may be much nicer syntaxes available.

Sections like the above are of course a last resort versus automated correction, but for quite a few situations there's just no other way, especially code that deals with character encodings, or custom collections that implement methods like keys()/iterkeys().