[Python-checkins] r75734 - in sandbox/trunk/2to3/lib2to3: fixes/fix_map.py tests/test_fixers.py

Georg Brandl g.brandl at gmx.net
Tue Oct 27 10:28:04 CET 2009


benjamin.peterson schrieb:
> Author: benjamin.peterson
> Date: Mon Oct 26 22:25:53 2009
> New Revision: 75734
> 
> Log:
> warn on map(None, ...) with more than 2 arguments #7203
> 
> 
> Modified:
>    sandbox/trunk/2to3/lib2to3/fixes/fix_map.py
>    sandbox/trunk/2to3/lib2to3/tests/test_fixers.py
> 
> Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_map.py
> ==============================================================================
> --- sandbox/trunk/2to3/lib2to3/fixes/fix_map.py	(original)
> +++ sandbox/trunk/2to3/lib2to3/fixes/fix_map.py	Mon Oct 26 22:25:53 2009
> @@ -50,7 +50,7 @@
>      |
>      power<
>          'map'
> -        args=trailer< '(' [any] ')' >
> +        args=trailer< '(' [arglist=any] ')' >
>      >
>      """
>  
> @@ -73,6 +73,14 @@
>              if "map_none" in results:
>                  new = results["arg"].clone()
>              else:
> +                if "arglist" in results:
> +                    args = results["arglist"]
> +                    if args.type == syms.arglist and \
> +                       args.children[0].type == token.NAME and \
> +                       args.children[0].value == "None":
> +                        self.warning(node, "cannot convert map(None, ...) "
> +                                     "with multiple arguments")

Maybe a short explanation *why* would be a good idea...

Georg

-- 
Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.



More information about the Python-checkins mailing list