C#3.0 and lambdas

Roel Schroeven rschroev_nospam_ml at fastmail.fm
Mon Sep 19 09:18:49 EDT 2005


Fredrik Lundh schreef:
> meanwhile, over in python-dev land:
> 
>     "Is anyone truly attached to nested tuple function parameters; 'def
>     fxn((a,b)): print a,b'?  /.../
> 
>     Would anyone really throw a huge fit if they went away?  I am willing
>     to write a PEP for their removal in 2.6 with a deprecation in 2.5 if
>     people are up for it."
> 

I for one would not like to see that disappear. I like being able to
write, for example:

def drawline((x1, y1), (x2, y2)):
    # draw a line from x1, y1 to x2, y2
    foo(x1, y1)
    bar(x2, y2)

instead of

def drawline(p1, p2):
    x1, y1 = p1
    x2, y2 = p2
    # draw a line from x1, y1 to x2, y2
    foo(x1, y1)
    bar(x2, y2)

or

def drawline(p1, p2):
    # draw a line from p1[0], p1[1] to p2[0], p2[1]
    foo(p1[0], p1[1])
    bar(p2[0], p2[1])


-- 
If I have been able to see further, it was only because I stood
on the shoulders of giants.  -- Isaac Newton

Roel Schroeven



More information about the Python-list mailing list