[MOVED] Lambda: How, Why, and Why not.

A place where you can post Python-related tutorials you made yourself, or links to tutorials made by others.

[MOVED] Lambda: How, Why, and Why not.

Postby Mekire » Thu Oct 17, 2013 10:10 am

User avatar
Mekire
 
Posts: 1710
Joined: Thu Feb 07, 2013 11:33 pm
Location: Tucson, Arizona

Re: Lambda: How, Why, and Why not.

Postby metulburr » Sun Dec 29, 2013 2:31 am

one of the most used times of using lambda is in Tkinter when you need a callback function with arguments.
here is a prefect example:
viewtopic.php?f=6&t=10118
we will be moving to python-forum.io on October 1 2016
more details here
User avatar
metulburr
 
Posts: 2243
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

Re: Lambda: How, Why, and Why not.

Postby Mekire » Mon Dec 30, 2013 2:06 am

I agree; they are very useful to this end.

They are of course, still not required, but they can be very convenient.

If your callback is sufficiently complicated I would still recommend writing a proper function and passing that instead.

-Mek
New Users, Read This
  • Use code tags when posting code.
  • Include any errors with your post (in code tags).
  • Describe your problem; not your chosen solution.
  • Make examples the minimum length to demonstrate your issue.
User avatar
Mekire
 
Posts: 1710
Joined: Thu Feb 07, 2013 11:33 pm
Location: Tucson, Arizona


Return to Tutorials

Who is online

Users browsing this forum: No registered users and 0 guests