On 3/2/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > On 3/2/07, Collin Winter <[EMAIL PROTECTED]> wrote: > > On 3/2/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > > Has anyone tried to create a 2to3 transformer for this? I think it > > > should be possible, although there are a few warts (like inserting the > > > new code after the docstring, and how to come up with names for the > > > anonymous tuple(s), and having to do it for potentially any number of > > > arguments. Still, it would require no dataflow analysis, and the > > > except transformer already has a similar statement insertion. So I > > > think it's doable. > > > > I can take a crack at this. I had to do similar things for the raise > > fixer before switching it over to use with_traceback(). > > That would be great! You may end up adding some generally useful code > for inserting statements into a block...
I just checked in fixes/fix_tuple_params.py (and associated tests). I still want to work on the code that generates the new names (so that they'll be more appropriate), but the functionality is there. I definitely want to sit down and abstract out the "insert these stmts at the beginning of a suite" logic. fix_tuple_params includes support for "def foo(): x = 5; y = 7"-style functions, which leads to some less-than-attractive code. Collin Winter _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com