Dictionary, keys and alias

Glauco 00515879256 at fastwebnet.it
Mon Jul 18 06:17:37 EDT 2005


I want to insert a concept of alias in a dict_based class.

The idea  is to have a facoltative name in the same dict that correspond 
at the same value. With this alias i can change original value.

example:

mydict['a'] = 1
I must define an alias  example: myFunctAlias( mydict, 'a', 'b')
print mydict
{'a':1, 'b':1}
mydict['b'] = 2
print mydict
{'a':2, 'b':2}


The only idea i have is to implement two dictionary one for convert 
name, alias in two keys with the same value (eg.numeric) in the first 
dict. The second for store only one time the k, v .


Any suggestion ?
Glauco



-- 

                          \\\|///
                        \\  - -  //
                         (  @ @  )
+---------------------oOOo-( )-oOOo--------------------------+
|                                                            |
| I have a dream that one day this nation will rise up and   |
|   live out the true meaning of its creed: "We hold these   |
|   truths to be self-evident:that all men are created equal.|
| I have a dream that one day on the red hills of Georgia    |
|   the sons of former slaves and the sons of former         |
|   slaveowners will be able to sit down together at a table |
|   of brotherhood.                                          |
| I have a dream that one day even the state of Mississippi, |
|   a desert state, sweltering with the heat of injustice    |
|   and oppression, will be transformed into an oasis of     |
|   freedom and justice.                                     |
| I have a dream that my four children will one day live in  |
|   a nation where they will not be judged by the color of   |
|   their skin but by the content of their character.        |
| I have a dream today.                                      |
|                                                            |
|                        Martin Luther King, Jr  28 Ago 1963 |
+------------------------------------------------------------+
|                    glauco(at)uriland.it                    |
|  www.uriland.it      .oooO                ICQ: 115323690   |
+--------------------- (   )------ Oooo.---------------------+
                         \ (        (   )
                          \_)        ) /
                                    (_/



More information about the Python-list mailing list