[Python-3000] removing destructuring del

Guido van Rossum guido at python.org
Mon Feb 25 18:07:23 CET 2008


On Sun, Feb 24, 2008 at 9:55 PM, Neal Norwitz <nnorwitz at gmail.com> wrote:
>  What bothers me more is assert of a tuple.  It does the wrong thing
>  from what newbies expect.  pychecker warns about this, but the version
>  of pylint in use at Google doesn't warn about this.  I wonder if we
>  should add a warning?
>
>  The code I recently saw was:
>   assert (something_short,
>                'Some long assertion string that needs its own line')
>
>  The original code that pylint warned about was:
>   assert something_short, \
>                'Some long assertion string that needs its own line'
>
>  Index: Python/compile.c
>  ===================================================================
>  --- Python/compile.c    (revision 61058)
>  +++ Python/compile.c    (working copy)
>  @@ -2056,6 +2056,9 @@
>                 if (assertion_error == NULL)
>                         return 0;
>         }
>  +       if (s->v.Assert.test->kind == Tuple_kind) {
>  +               printf("got a tuple\n");
>  +       }
>         VISIT(c, expr, s->v.Assert.test);
>         end = compiler_new_block(c);
>         if (end == NULL)
>
>  Seems to do the trick.  Maybe this should be turned into a real patch
>  with using PyErr_Warn()?

+1

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


More information about the Python-3000 mailing list