A small inconsistency in syntax?

Chris Barker chrishbarker at home.net
Fri Oct 26 18:56:43 CEST 2001


Terry Reedy wrote:

> As I understand it, the rule is this:  if item on LHS is tuple rather
> than name, then corresponding object on RHS must be a tuple, which
> will then be seen as collection rather than object in itself and
> consequently unpacked for matching to items within LHS tuple.
> Allowing for null matches and applying the rule recursively,

Actually either side can be a sequence, not just a tuple:
>>> (a,b) = [3,4]
>>> a
3
>>> b
4
>>> [a,b] = (3,4)
>>> a
3
>>> b
4
>>> (a,b) = "df"
>>> a
'd'
>>> b
'f'

I'm not sure that changes this argument in any way....

-Chris

-- 
Christopher Barker,
Ph.D.                                                           
ChrisHBarker at home.net                 ---           ---           ---
http://members.home.net/barkerlohmann ---@@       -----@@       -----@@
                                   ------@@@     ------@@@     ------@@@
Oil Spill Modeling                ------   @    ------   @   ------   @
Water Resources Engineering       -------      ---------     --------    
Coastal and Fluvial Hydrodynamics --------------------------------------
------------------------------------------------------------------------



More information about the Python-list mailing list