[Python-3000] removing destructuring del

Andrew Dalke dalke at dalkescientific.com
Fri Feb 22 21:42:18 CET 2008


On Feb 22, 2008, at 6:07 PM, Alexander Belopolsky wrote:
> Maybe Py3k should eliminate the list form, but allow empty tuples
> as useful in auto-generated code (deleting variable number of
> names.)

That seems pretty theoretical.  It's easy to add a "if has variables"  
check first.  I looked at quite a few libraries grepping for unusual  
del statements and didn't find any, including nothing like 'del []'

BTW, there's a bug in the error message for 'del ()'

Python 2.5 (r25:51908, Oct  9 2006, 13:24:22)
[GCC 3.4.6 [FreeBSD] 20060305] on freebsd6
Type "help", "copyright", "credits" or "license" for more information.
 >>> del []
 >>> del ()
   File "<stdin>", line 1
SyntaxError: can't assign to ()
 >>>


Python 3.0a2 (r30a2:59382, Feb 20 2008, 12:09:57)
[GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
 >>> del []
 >>> del ()
SyntaxError: can't assign to () (<stdin>, line 1)
 >>>

This is the exception I want to see when someone does a destructuring  
del, though with corrected wording.

				Andrew
				dalke at dalkescientific.com




More information about the Python-3000 mailing list