A small inconsistency in syntax?
tjreedy at home.com
Fri Oct 26 02:56:35 CEST 2001
"Michael Abbott" <michael.g.abbott at ntlworld.com> wrote in message
news:Xns9145D94516673michaelrcpcouk at 22.214.171.124...
> However, Python tuple assignment does look somewhat like pattern
> for example, sometimes my .read() method returns some (one) thing,
> time, status, ((value, boring),) = myobject.read()
> So here I think of this as matching the one value (itself a pair of
> that happens to be returned. This looks awfully like pattern
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.
Terry J. Reedy
More information about the Python-list