creating dictionnaries

Hans Nowak ivnowa at hvision.nl
Tue Jun 22 22:49:27 CEST 1999


On 22 Jun 99, Christian Caremoli wrote:

> Hi,
> Dictionnaries can be created like that :
> d={'a':1,'b':2}
> 
> By calling a function you create a dictionnary like that :
> def f(**d):
>    return d
> 
> d=f(a=1,b=2)
> 
> I would like to be able to create dictionnaries with some similar syntax
> like keyed tuples :
> d=(a=1,b=2)
> 
> Is there a way to do that ?

Nope. :-) I wonder why you would want this? As far as I'm concerned, 
there's not screamingly much difference between

d=f(a=1,b=2)    # valid

and

d=(a=1,b=2)     # invalid


--Hans Nowak (ivnowa at hvision.nl)
Homepage: http://fly.to/zephyrfalcon




More information about the Python-list mailing list