Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
what "return" means?
#8
You are returning a function, a lambda is an anonymous function. Functions in Python are objects and can be passed around, mydoubler is now a function and can be called. What is hapening is that each time you call myfunc with a different integer you can get back a unique function that returns that value * its argument. You could say this is like a factory for creating functions on the fly that you don't have to type out manually. This is the best explanation I can think of that would hopefully help. I would lookup How to use Python Lambda Functions There are a lot of resources that can explain both lambdas and functions that return functions. That's where I would start looking.
Reply


Messages In This Thread
what "return" means? - by PY_beginner - Oct-04-2019, 10:02 PM
RE: what "return" means? - by Larz60+ - Oct-04-2019, 11:05 PM
RE: what "return" means? - by prih_yah - Oct-09-2019, 12:50 PM
RE: what "return" means? - by perfringo - Oct-09-2019, 01:37 PM
RE: what "return" means? - by ichabod801 - Oct-09-2019, 01:40 PM
RE: what "return" means? - by jefsummers - Oct-09-2019, 04:22 PM
RE: what "return" means? - by knackwurstbagel - Oct-10-2019, 04:35 AM
RE: what "return" means? - by DeaD_EyE - Oct-10-2019, 07:05 AM
RE: what "return" means? - by newbieAuggie2019 - Oct-10-2019, 07:18 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Understand what it means that everything in Python is an object... bytecrunch 8 3,911 Mar-19-2021, 04:47 PM
Last Post: nilamo
  effective means to flip boolean values? Exsul 3 4,411 Aug-25-2019, 03:58 PM
Last Post: Exsul
  what means in Python the "->"? lsepolis123 2 2,038 Aug-22-2019, 08:08 AM
Last Post: DeaD_EyE
  Smtplib: What does context argument means? Pythenx 1 3,138 Mar-27-2019, 06:25 PM
Last Post: nilamo
  what from .something means sylas 1 2,637 May-17-2018, 06:19 AM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020