List and order

Nic nospam at nospam.nospam
Mon May 15 14:23:32 CEST 2006

Hello Miki,

Many thanks for the support.
I tried to insert and execute the code, but the following error happens:

Traceback (most recent call last):
  File "", line 10, in ?
    edges.sort(key = lambda u, v: (ddeg(u), ddeg(v)))
TypeError: <lambda>() takes exactly 2 arguments (1 given)

Do you know how is it possible to delete it?


"Miki" <miki.tebeka at> ha scritto nel messaggio 
news:1147691967.998184.285120 at
> Hello Nic,
> Python lists has a very powerfull buid-in "sort".
> edges = list(G.edges())
> edges.sort(key = lambda u, v: (ddeg(u), ddeg(v)))
> for u, v in edges:
>    print u,v,  # Note the training comma to avoid newline
> print
> HTH,
> Miki

More information about the Python-list mailing list