[Tutor] Dictionaries of Tuples of Strings

Luke Paireepinart rabidpoobear at gmail.com
Fri Feb 23 22:26:30 CET 2007


Tim Golden wrote:
> Luke Paireepinart wrote:
>
>> That's because you can't make tuples of single values.
>> Parenthesis are ways of controlling order of operation.
>> They don't create tuples unless there's more than one value.
>
>> Think of it like this:
>> a TUple needs TWO elements or more.
>> Solution:
>> use lists.  They can contain single elements.
>
> Don't know where you got that one from:
>
> <code>
> t = (1,)
> type (t)
>
> </code>
>
> In fact, in a certain way, it's the comma which makes the tuple.
> Brackets are only needed in some circs to disambiguate (eg in
> parameter lists to functions)
Ah yes , I forgot about that.  I've seen that before and wondered why 
there was that extra comma.
Oops.
I guess the difference, then, is whether your data collections need to 
be mutable or not.
>



More information about the Tutor mailing list