newbie question about dictionnary ?

Michael Peuser mpeuser at web.de
Fri Sep 5 04:48:17 EDT 2003


"Michael Peuser" <mpeuser at web.de> schrieb im Newsbeitrag
news:bj9h99$btm$02$1 at news.t-online.com...
>
> "Sophie Alléon" <alleon at club-internet.fr> schrieb im Newsbeitrag
> news:3f582f90$0$20952$7a628cd7 at news.club-internet.fr...
>
>
> > for doing this I thought the dictionary was excellent but the key is a
> > string while I want it
> > to be the 2 points forming the edge ? How to do it ?
> >
>
> Luckily you are wrong! Keys can be numbers, strings, AND tuples of
immutable
> data!!!
>
> Example:
>
> a="first"
> b=2
> x={}
> x[(a,b)]="hi"
> print x
>
> However it will not work when assigning objects or lists to a or b.


... and so I had been wrong as well ;-)
Instances ARE immutables so it WILL work smoothly as others have already
posted.

MP






More information about the Python-list mailing list