A small inconsistency in syntax?
rnd at onego.ru
Tue Oct 30 05:23:34 CET 2001
On Thu, 25 Oct 2001, Michael Abbott wrote:
>It seems to me that there's a little inconsistency in assigning to tuples:
> >>> (x,) = ()
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> ValueError: unpack tuple of wrong size
>Yes, that's what I expect.
> >>> () = ()
> SyntaxError: can't assign to ()
>Eh? Why not? It's just a matter of checking that the right hand side
>really is an empty tuple...
Well, maybe one day Python will allow:
as well ;-)
() on the LHS is a target list constructor and assignment
really needs targets there.
Sincerely yours, Roman Suzi
_/ Russia _/ Karelia _/ Petrozavodsk _/ rnd at onego.ru _/
_/ Tuesday, October 30, 2001 _/ Powered by Linux RedHat 6.2 _/
_/ "Tax rich bachelors heavily. Why should they be so happy?" _/
More information about the Python-list