A small inconsistency in syntax?

Terry Reedy tjreedy at home.com
Fri Oct 26 08:10:17 CEST 2001


"Greg Ewing" <greg at cosc.canterbury.ac.nz> wrote in message
news:3BD8C9F6.BBBD605A at cosc.canterbury.ac.nz...
> Terry Reedy wrote:
> >
> > An so it is.  If the patterns do not match, an exception is
raised.
> > However, after the match, the names (in your example above)
'time',
> > 'status', 'value', and 'boring' are then bound to the
corresponding
> > objects in the current namespace.
>
> In the case in question, i.e.
>
>    () = ()
>
> the patterns clearly do match. And, every name in
> the LHS has a corresponding value in the RHS. The
> numbers of both these things happen to be 0, but
> so what?
>
> I think Michael Abbot is quite right. There's no
> reason this shouldn't be a legitimate, albeit
> degenerate, case of tuple unpacking.

The above is only a special case of the general question he raised.
He also thought that

a,() = somefunc()

should be legal -- matching, I presume, something like 1,().  Do you
agree with that also?  I think the logic is the same.

Terry J. Reedy








More information about the Python-list mailing list