[Tutor] Dictionaries of Tuples of Strings

Bill Sconce sconce at in-spec-inc.com
Fri Feb 23 22:26:18 CET 2007


Don't feel bad.  Everyone who works with Python bumps into this.
And more than once...

The preceding reply is correct.  But perhaps this is more specific:

> TYPES_PYTHON_TO_XML = {
>            'int':('xs:hexbinary','xs:integer'),
>            'str':("xs:string")
>            }


The problem is here:
>            'str':("xs:string")
This is semantically identical to:
>            'str':"xs:string"



Problem corrected:
>            'str':("xs:string",)
                               ^
                             comma
                             
It helps to think,
   tuples are made by commas
   parentheses (only) enclose expressions
It's not true that
   parentheses indicate tuples
(They don't.  Not unless there are "commas in there".)


HTH,

Bill


More information about the Tutor mailing list