Expandable 2D Dictionaries?

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Fri Jul 6 13:46:16 EDT 2007


On Fri, 06 Jul 2007 16:22:35 +0000, Robert Dailey wrote:

> On Jul 6, 11:09 am, Jean-Paul Calderone <exar... at divmod.com> wrote:
>> This gets much easier if you change your structure around a bit:
>>
>>     d = {}
>>     d["cat", "paw"] = "some string"
>>
>> Jean-Paul
> 
> I like this format. I'm not familiar with it however. In my research
> of python I was not aware it was legal to have comma operators inside
> of the brackets. What does this mean? Is there some terminology that I
> can search for to research this concept? Thanks.

It's mapping the tuple ('cat', 'paw') to 'some string'.  Commas make
tuples.  The parenthesis are just necessary for the literal empty tuple
and if the syntax would be ambiguous otherwise.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list