Тёмный

Python Lambda Functions?? 

b001
Подписаться 267 тыс.
Просмотров 187 тыс.
50% 1

⭐ Join my Patreon: / b001io
💬 Discord: / discord
🐦 Follow me on Twitter: / b001io
🔗 More links: linktr.ee/b001io
Background Music:
Gentle Lo-Fi Vlog Background Music | Cookies by Alex-Productions | onsound.eu/
Music promoted by www.free-stock...
Creative Commons / Attribution 3.0 Unported License (CC BY 3.0)
creativecommon...

Наука

Опубликовано:

 

5 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 128   
@thefoolishgmodcube2644
@thefoolishgmodcube2644 Год назад
Another thing is that lambda functions are faster to create and call compared to regular functions, so if you're obsessed with performance and your function only has a return statement you might as well make it a lambda function.
@steveman1982
@steveman1982 Год назад
But then again, python isn't really the right tool, if you want speed.
@thefoolishgmodcube2644
@thefoolishgmodcube2644 Год назад
@@steveman1982 Yeah, more reason why you should opt for the fastest Python code, to make up for its slowness.
@Inf1e
@Inf1e Год назад
if you obsessed with performance you really shouldn't use Python in first place
@bamremix8235
@bamremix8235 11 месяцев назад
@@Inf1ewell tbh most of the popular machine learning and deep learning modules are easily accessible through python. So saying performance should be ignored while using python is stupid
@ajflink
@ajflink 4 месяца назад
​@@bamremix8235 Also, there are ways to make things faster and more efficient in Python if you know what you are doing. There are so many people that blame bad performance on Python yet have so much redundancy in their code that there is no surprise that things are bad performance wise or using a large amount of memory. The most infamous example that I can think of is ArcGIS Pro. If you know, you know. Also, since Python is not bound by strict typing, you can do crazy things not possible in most other languages.
@deanbond007
@deanbond007 Год назад
Thank you for all the videos you make they're really informative and make learning so much easier
@b001
@b001 Год назад
Wow, thank you so much! So generous of you! I'm glad you enjoy my content!
@lindavid1975
@lindavid1975 2 месяца назад
Being able to play the piano whilst programming is a skill.
@Samreyna1
@Samreyna1 16 дней назад
Makes you think, what he is playing piano with!
@TheRealKitWalker
@TheRealKitWalker Год назад
I simply love the fact, that how concise this video is. Fantastic. I finally Understood the dreaded lambda function. 💪 Thanks so much dude.
@WibleWobble
@WibleWobble Год назад
its like you can read my mind, every time during the video i had a question, a second later you answered it. Well deserved sub 👍
@marclaygeorges2786
@marclaygeorges2786 Год назад
Your Python videos are always clear and concise explanations with great examples. Thank you for making these videos!
@b001
@b001 Год назад
Wow! Thank you so much! I’m so glad you enjoy them!!
@ksspqf6016
@ksspqf6016 Год назад
That's all very nice but I'm too stupid to put that skill into practise
@MarleykHarbdul-xp9ez
@MarleykHarbdul-xp9ez 4 месяца назад
That's your problem
@ksspqf6016
@ksspqf6016 4 месяца назад
​@MarleykHarbdul-xp9ez I've rewatched it again and now I'm even more confused than i was a year ago
@montagecentral1379
@montagecentral1379 3 месяца назад
@@ksspqf6016 dedication
@ElijahWatts-ji9yx
@ElijahWatts-ji9yx 2 месяца назад
​@ksspqf6016 you're probably over complicating it
@seancore1
@seancore1 27 дней назад
@@MarleykHarbdul-xp9ez what is wrong with you
@jackkraus6948
@jackkraus6948 8 месяцев назад
What I first used lambda functions for was when I created minesweeper in tkinter. The button components took a function parameter to call when pressed. Since in Minesweeper pressing an empty cell (no adjacent bombs, i.e. no number) reveals the cells around it, I wrote a recursive function that when given a row and column number revealed the cell value in that spot and called the function for the cells around it if the cell was empty. I used lambda to iteratively create functions using that function while passing in a set row and column. TL:DR you can use lambda to create a version of a defined function with filled in parameters
@abhinavjoe
@abhinavjoe 11 месяцев назад
My man not only explained me what lamda functions are, but also cleared my doubts about how the map() function works. Very informative and well put video. You're the best.
@avb5300
@avb5300 13 дней назад
The music was an awesome touch, thanks a bunch
@EricWAtchesVideos
@EricWAtchesVideos 8 месяцев назад
Thank you for the clear explanation!! I think that like so many of these language features, they solve a problem that doesn't exist. It's nice to have features, but I doubt that I will end up using this ever.
@robbertvandermeijden
@robbertvandermeijden 5 месяцев назад
perfect video. Straight to the point and told me everything I needed to know. Thanks!
@qayyax
@qayyax 7 месяцев назад
Thank you so much for this video. You are blessed
@mooseydev
@mooseydev День назад
Excellent, concise, aesthetic explanation. Liked & subbed.
@FetchTheCow
@FetchTheCow 9 месяцев назад
Thank you for the use case! I didn't get it after your lambda short, but now I do.
@FollowPathfinder
@FollowPathfinder Год назад
Thank’s for the explanation. Lambda functions with map make things look so much easier, I wonder why is this even considered as intermediate Python knowledge?
@fabricehategekimana5350
@fabricehategekimana5350 Год назад
I think it's because this concept belong to functional programming and go a bit deeper than what people thougth (It come from the lambda calculus). Generally people start with an imperative programming style, go to an object oriented programming style and maybe go to functional programming
@veelone3663
@veelone3663 Месяц назад
@@fabricehategekimana5350 huh ? im not even taking intermediate yet and lambda is being introduced rn. You're telling me it gets deeper than this? I'm fucked ..
@ArticlesGD
@ArticlesGD Месяц назад
lambda: HALF LIFE
@handlemyece
@handlemyece 6 месяцев назад
Thank you for the video!
@jacksonmadison9994
@jacksonmadison9994 8 месяцев назад
Man, computer science is so difficult.
@veelone3663
@veelone3663 Месяц назад
literally taking programming rn and Idk wtf I'm doing lol
@darss10
@darss10 Год назад
Great video! Very simple and clear explanation!! I am currently learning tkinter and I was told that you can use the lambda keyword when assigning a command to a button -> button_1 = tkinter.Button(command=lambda: button_click()). What's the difference between using lambda and just assigning the function without lambda -> button_1 = tkinter.Button(command=button_click)?? Thanks!
@chrysos
@chrysos Год назад
tkinter takes functions as arguments and calls them with their own arguments. For example if u use .bind("", func) on the main window ure function gets call on press of the Return key (Enter) with ure mouse possitions and more as argumets. this does not matter for ure button command, because it provides no arguments. U can use both of ure examples, but if u want to provide ure own arguments u need to use lambda
@chrysos
@chrysos Год назад
from tkinter import Tk, Button def func(*args): print(args) tk = Tk() tk.geometry("300x200") tk.bind("", func) button = Button( command=func) button.pack() tk.mainloop()
@chrysos
@chrysos Год назад
run this code, click the button, press Enter and look at the output
@chrysos
@chrysos Год назад
i am not a pro its just what i could understand myself
@darss10
@darss10 Год назад
@@chrysos WOW thanks! So, if I need to pass arguments into my button command, I use lambda, is that it?
@alberthernandez5578
@alberthernandez5578 9 месяцев назад
Well this was easy to follow, thank you for the videos bro, they really help out
@sapogatowo
@sapogatowo Год назад
Ow mannnn, your code-communication skills are truly amazing! One question, do you have in mind continuing the 'How 2 Python' series? If so, when are you dropping the next video? Hope you are having a great day uwu!
@tanmaypatel4152
@tanmaypatel4152 Год назад
Great video as always! BTW, which font are you using? It is so elegant.
@gaberg21
@gaberg21 Год назад
you explained it super well! will be sending this video to friends who dont get it
@ninavanleeuwen1183
@ninavanleeuwen1183 Год назад
thank you for the video, but the music is too loud for me!
@yashwantdhole7645
@yashwantdhole7645 Год назад
My goodness. This is the best and concise explanation of dreaded lambda function
@yrebrac
@yrebrac Месяц назад
love the concise explanation
@chrysos
@chrysos Год назад
why do u use brakets with ure return ?
@jojojux
@jojojux Год назад
That triggered me too.
@b001
@b001 Год назад
I saw that when editing the video. I'm not sure why I did that lol
@NeverSaid-
@NeverSaid- 5 месяцев назад
This looks like a security vulnerability waiting to happen. And this whole example can be reduced to 2 lines of code: Nums =[3,4,5,6,7] Cubed = [item**3 for item in Nums]
@stephenburke7108
@stephenburke7108 7 месяцев назад
you can lose lines 1-7 and just replace line 10 with: cubed = list(map(lambda x: x**3, nums))
@avgvstvs96
@avgvstvs96 Год назад
dont stop Sir Bool, these videos breath life into my soul
@amansjourneys2
@amansjourneys2 7 месяцев назад
Thank you for this! My follow up question would be wouldnt it be easier to create a for loop to cube "nums" and add it to a list called "cubed"?? I'm not seeing how using lambda was faster/easier here
@jirafey_
@jirafey_ Год назад
Did you ever make content online? You seem to be professional asf
@Adaephonable
@Adaephonable Год назад
This video is inline content...
@magic_cow
@magic_cow Год назад
In a thing I’m working on, I used lambda functions and assigned them to a variable, because they allowed my to put some a if else statement onto 1 line instead of 5 lines, this was amazing since this allowed me to bring 15 lines of codes down to 3 lines of code UPDATE: I put the lambda functions into the things that were calling it, now I am saving 3 more lines of code. Yippie! Function format: (Line 1: defining function Line 2: if statement Line 3: run function Line 4: else statement Line 5: run diffrent function)
@xeurek4
@xeurek4 8 месяцев назад
Nice explanation
@seanshimon
@seanshimon 6 месяцев назад
lambda vs not lambda: def my_map(my_func, my_iter) -> list: result = [] for item in my_iter: new_item = my_func(item) result.append(new_item) return result nums = [3, 4, 5, 6] cube_using_lambda = my_map(lambda x: x**3, nums) print(cube_using_lambda) def my_func_cube(size: int) -> int: return size**3 cube_func = my_func_cube print(my_map(cube_func, nums))
@Liz4rdMan
@Liz4rdMan 9 месяцев назад
It is also usable when you only use a function once so you won't need to create a whole function for it and no one will use it.
@ajflink
@ajflink 4 месяца назад
lambda is like decorator. They are useful tools but you are not severely crippling yourself by not using them. Due to what I am coding for and how I write Python code, I have never saw any need or desire to use decorators. I do see personal usage for lambda, though.
@mirlamontano6640
@mirlamontano6640 Год назад
thank you for this video! very informative, useful and clear!! subscribed 💖
@epsi
@epsi Год назад
my_map = lambda my_func, my_iter: (my_func(x) for x in my_iter) cubed = list(my_map(lambda x: x**3, nums)) Generators are great, except when they're not.
@neomimendoza8339
@neomimendoza8339 Год назад
Hello! Could you please share your programming environment color scheme and your font? They're so easy on the eyes!
@ahbpoo
@ahbpoo Год назад
I searched his previous comments, where someone asked this question, and they got the answer: SynthWave '84
@heel57
@heel57 2 месяца назад
good explanation but the music is disturbing
@raylink1722
@raylink1722 Месяц назад
Thank you so much
@inteligenciaartificiuau
@inteligenciaartificiuau 8 месяцев назад
Amazing! Thanks!
@williamomon3894
@williamomon3894 11 месяцев назад
Hey man lovely vid , one question what extension got your IDE to look like that
@MusicEffekt
@MusicEffekt 11 месяцев назад
please make the font a bit larger. Thanks
@sews1523
@sews1523 8 месяцев назад
awesome vid actually, thanks
@AHWAProductions
@AHWAProductions Год назад
man you explain it so well 😭
@viktoreidrien7110
@viktoreidrien7110 Год назад
excellent explanation, thanks man
@radishark8449
@radishark8449 7 месяцев назад
Simple and useful tutorial❤
@tompov227
@tompov227 Год назад
Your videos are really informative! What font do you use in your code editor, I really like it and I currently just use the default in mine
@dirtypiggy3334
@dirtypiggy3334 2 месяца назад
love the profile pic lol
@cother8312
@cother8312 3 месяца назад
So it's like an arrow function in JavaScript?
@Sdksakdjas
@Sdksakdjas 5 месяцев назад
what vscode theme do u use i really like this one!
@learningforever957
@learningforever957 Год назад
Thank you so much, perfectly explained
@jonathanvioleta3578
@jonathanvioleta3578 11 месяцев назад
From my understanding, its basically a inline function ?
@carlosmillananhel2878
@carlosmillananhel2878 Год назад
for js people, as much as i understood lambda is the same that (params)=>{...}
@ironmonkey1990
@ironmonkey1990 Месяц назад
thank you
@jakeaustria5445
@jakeaustria5445 Месяц назад
Thanks
@CAMPERRRR
@CAMPERRRR 5 месяцев назад
You need to keep making content
@FazliddinSaydullayevbek
@FazliddinSaydullayevbek 7 месяцев назад
Your python is looks really beautiful how can i download that
@itsm0saan
@itsm0saan Год назад
what is the font you are using.?
@dakookh
@dakookh Год назад
Jeez… Still can’t get it😢
@fcesteghlal
@fcesteghlal 6 месяцев назад
why music in the background?
@khucthuydu1991
@khucthuydu1991 14 дней назад
Amazing
@DiegoGomez-en7pn
@DiegoGomez-en7pn Год назад
What software do you use to record your videos and shorts?
@dipeshsamrawat7957
@dipeshsamrawat7957 Год назад
Excellent ❤
@chaithanyav6646
@chaithanyav6646 4 месяца назад
Brilliant
@baliDOTid
@baliDOTid Год назад
what's your vs code theme?
@CHUAN-CHI
@CHUAN-CHI 9 месяцев назад
Thank you
@francoli2281
@francoli2281 Год назад
what colour theme are you using?
@sreejishnair5922
@sreejishnair5922 Год назад
Bro what keyboard do you use?
@ahbpoo
@ahbpoo Год назад
What theme do you use?
@sparetimes1215
@sparetimes1215 Месяц назад
Good video, but don't add background music.
@barbellbilly
@barbellbilly Год назад
What vscode theme is this?
@sysy_ep
@sysy_ep Год назад
Synthwave '84
@barbellbilly
@barbellbilly Год назад
@@sysy_ep Thank you so much!
@JustineEllyn
@JustineEllyn 7 месяцев назад
... half-life.
@BroSience.c
@BroSience.c Год назад
What vs code theme do you use?
@Oliver-Zen
@Oliver-Zen Год назад
thanks!
@Fisal_Gamal_Elgendy_2002
@Fisal_Gamal_Elgendy_2002 Год назад
thanks
@karimjapparov5324
@karimjapparov5324 11 месяцев назад
thank you
@hubertgrzymkiewicz8883
@hubertgrzymkiewicz8883 11 месяцев назад
awesome!!
@jaksiz
@jaksiz 8 месяцев назад
You're awesome
@Deveus-y4s
@Deveus-y4s Год назад
Salute to you.
@neonblowfish
@neonblowfish 4 месяца назад
Great video, but annoying music
@vladoxgz
@vladoxgz Год назад
cubed = [n**3 for n in nums]
@tsunningwah3471
@tsunningwah3471 8 месяцев назад
zhina
@ego-lay_atman-bay
@ego-lay_atman-bay Год назад
What are lambda functions in python? Horse crap
@russ7k
@russ7k Год назад
So, writing lambda functions are better than writing normal functions?
@krapiak
@krapiak Месяц назад
what theme do you use??
@mirzaimadbaig
@mirzaimadbaig Год назад
nicely explained
@Zaryan___Zaryan
@Zaryan___Zaryan 11 месяцев назад
(💲10.00) thnaks your video is so best😀😀
@Fisal_Gamal_Elgendy_2002
@Fisal_Gamal_Elgendy_2002 Год назад
thanks
Далее
Python: Lambda, Map, Filter, Reduce Functions
9:59
Просмотров 382 тыс.
*Args and **Kwargs in Python
3:49
Просмотров 278 тыс.
Dear Functional Bros
16:50
Просмотров 517 тыс.
25 nooby Python habits you need to ditch
9:12
Просмотров 1,8 млн
How To Use List Comprehension In Python
6:41
Просмотров 9 тыс.
Learn Python LAMBDA in 6 minutes! 🚮
6:50
Просмотров 4,7 тыс.
How Swarms Solve Impossible Problems
9:41
Просмотров 31 тыс.
5 Good Python Habits
17:35
Просмотров 550 тыс.
Please Master These 10 Python Functions…
22:17
Просмотров 170 тыс.
The Algorithm Behind Spell Checkers
13:02
Просмотров 414 тыс.
3x 2x 1x 0.5x 0.3x... #iphone
0:10
Просмотров 2,8 млн