[Python-3000] removing destructuring del

Andrew Dalke dalke at dalkescientific.com
Fri Feb 22 08:27:37 CET 2008


On Feb 22, 2008, at 2:25 AM, Guido van Rossum wrote:
> What syntax would you allow instead? Just del variable, variable, ...?

Yes.  These are and should be legal

del a, b[1], c.d
del (e+f).g[9]().h

but I think this should not be legal

del a, (b, c)

That should raise

   SyntaxError: can't delete tuple

and I would also like it if the following raised the same error

   del (a, b)

but people use it now and I can see that perhaps, like with the from  
statement, using '()' for long expressions is useful

   del (some_very_large_variable_name[1],
        another_large_variable_name[2].with_attribute)


I also think

   del a,

should not be legal ("SyntaxError: trailing comma not allowed without  
surrounding parentheses"?), but that's getting into my own personal  
preferences.

				Andrew
				dalke at dalkescientific.com




More information about the Python-3000 mailing list