Guido van Rossum <guido <at> python.org> writes: > > On Thu, Feb 21, 2008 at 11:27 PM, Andrew Dalke > <dalke <at> dalkescientific.com> wrote: > .. I think this should not be legal > > > > del a, (b, c) > > > > That should raise > > > > SyntaxError: can't delete tuple .. > These all make sense to me, but at the same time it seems such a minor > issue that I'm not sure we should bother. It would probably end up > being more custom syntax -- right now it just uses exprlist in the > grammar and is limited to assignment targets by the compiler. >
I was always wondering why both lists and tuples are allowed as assignment targets. As far as I can tell, the only difference is in the corner cases such as >>> del [] >>> del () File "<stdin>", line 1 SyntaxError: can't assign to () >>> [] = () >>> () = () File "<stdin>", line 1 SyntaxError: can't assign to () Maybe Py3k should eliminate the list form, but allow empty tuples as useful in auto-generated code (deleting variable number of names.) _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
