Many-to-many pattern possiable?

7stud bbxx789_05ss at yahoo.com
Sat May 19 13:41:53 EDT 2007


On May 19, 10:33 am, Jia Lu <Roka... at gmail.com> wrote:
> Hi all
>
>  I see dict type can do 1-to-1 pattern, But is there any method to do
> 1-to-many, many-to-1 and many-to-many pattern ?

How about:

one_to_many = {"a":[10, "red", 2.5]}

many_to_1 = {("red", 2.5, 3):"hello"}

many_to_many = {("red", 2.5, 3):[10, 20, 30]}

In reality, everything is mapped 1-1.  I wonder if there is a computer
language where that isn't the case?




More information about the Python-list mailing list