lambda a plusieurs arguments

Discussion in 'Python' started by nico, May 27, 2005.

  1. nico

    nico Guest

    Bonjour,

    Comment faire une fonction lambda a plusieurs arguments ?

    >>> (lambda a:a+1)(2)

    3
    >>> f=(lambda (a,b):a+b)
    >>> f(5,6)

    Traceback (most recent call last):
    File "<stdin>", line 1, in ?
    TypeError: <lambda>() takes exactly 1 argument (2 given)
    >>> f((5.6))

    Traceback (most recent call last):
    File "<stdin>", line 1, in ?
    File "<stdin>", line 1, in <lambda>
    TypeError: unpack non-sequence

    pourquoi ca ne marche pas ? je ne comprends pas le message d'erreur !

    Merci.


    --
    nico
     
    nico, May 27, 2005
    #1
    1. Advertising

  2. Nico,

    seems to be a good place to post
    questions related to Python if you intend to use
    french.

    -> http://www.aful.org/wws/arc/python/

    ((
    des questions rédigées en français sont plus
    à leur place sur des liste de diffusions
    nationales ...
    ))

    Regards,

    SB
     
    =?iso-8859-1?q?S=E9bastien_Boisg=E9rault?=, May 27, 2005
    #2
    1. Advertising

  3. nico

    nico Guest

    Bonjour,

    > seems to be a good place to post
    > questions related to Python if you intend to use
    > french.
    >
    > -> http://www.aful.org/wws/arc/python/
    >
    > ((
    > des questions rédigées en français sont plus
    > à leur place sur des liste de diffusions
    > nationales ...
    > ))


    Désolé, je me suis trompé de groupe en postant... :(

    --
    nico
     
    nico, May 28, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Roman Suzi
    Replies:
    13
    Views:
    627
    Bengt Richter
    Jan 7, 2005
  2. Jp Calderone

    Re: lambda a plusieurs arguments

    Jp Calderone, May 27, 2005, in forum: Python
    Replies:
    1
    Views:
    408
  3. Paul Brannan

    lambda arguments in an extension

    Paul Brannan, Sep 12, 2007, in forum: Ruby
    Replies:
    0
    Views:
    92
    Paul Brannan
    Sep 12, 2007
  4. Steve Dogers

    lambda vs non-lambda proc

    Steve Dogers, Mar 30, 2009, in forum: Ruby
    Replies:
    1
    Views:
    202
    Sean O'Halpin
    Mar 30, 2009
  5. Haochen Xie
    Replies:
    4
    Views:
    261
    Haochen Xie
    Mar 17, 2013
Loading...

Share This Page