Python lambda, map, filter, & reduce - Higher Order Functions for Beginners

  Рет қаралды 11,156

Dave Gray

Dave Gray

Күн бұрын

Пікірлер: 33
@xzex2609
@xzex2609 Жыл бұрын
he is such a great teacher and I actually am learning JS from his channel . and even though I know python for years still enjoying to see his way of teaching. thanx
@SonuSharma-sb4bo
@SonuSharma-sb4bo Ай бұрын
Amazing teaching skills! 🎉 This tutor deserves millions of subscribers.
@Leesdjo
@Leesdjo Жыл бұрын
Thank you Dave. I have learned lots from you as a student when I first found out about your KZbin channel. Thank you for your kindness.
@insteresting
@insteresting Жыл бұрын
Very nice tutorial, Dave!
@TannerBarcelos
@TannerBarcelos Жыл бұрын
I feel like seeing this in JavaScript before Python helps folks understand it even better. Sure, lambda arg: are a little different than ()=> but given Python isn’t functional in nature, I noticed many folks find this to be confusing. You did an awesome job explaining it!
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
Thank you!
@xzex2609
@xzex2609 Жыл бұрын
once you see its actual use cases (call backs ,....) you will find that the lambda is a very effective tool you can't do without , maybe that's why pep-8 recommends that lambda should not be assigned ,cause its own use cases are very special , like in GUI programming if a widget need to pass one or two parameters to a function , you can not use a function for that unless you wrap your function inside an otter function that calls inner function to have a return value , but a simple lambda expression will save the day and you don't need to even define a function even if your command is a function like print( argument) you can't use () in your command= in your widget and you had to wrap the print inside a function otherwise print returns None but by using lambda you simply can use Button(......, command=lambda:print('string')) or command = lambda event:print(event). otherwise you got to use a higher order function (nested wrapper / inner) function
@muzhaffarhaydar7928
@muzhaffarhaydar7928 3 ай бұрын
thanks dave!
@OneStopMusic.
@OneStopMusic. 6 ай бұрын
great and to the point explanation
@johnaweiss
@johnaweiss 11 ай бұрын
6:00 Would be helpful if your commented lambda rewrites inluded the var name as you had originally entered. Without the var name, the commented lambdas are not equivalent to the defs.
@danielurbanowicz7882
@danielurbanowicz7882 8 ай бұрын
Solution for reformat lambda by vs code is to put parentheses around the lambda assignment: squared = (lambda num: num * num) 😃
@xzex2609
@xzex2609 Жыл бұрын
According to PEP-8 anonymous functions better not assign to a variable their use is more like call backs like arr.sort(key = lambda data:data[0]) and other stuff like that. but visual studio doesn't apply the pep-8 unless you install an extension. I remember the extension was very annoying , but now see it as a tool to learn pep 8 standards in the action to write better code.
@xzex2609
@xzex2609 Жыл бұрын
once you see its actual use cases (call backs ,....) you will find that the lambda is a very effective tool you can't do without , maybe that's why pep-8 recommends that lambda should not be assigned ,cause its own use cases are very special , like in GUI programming if a widget need to pass one or two parameters to a function , you can not use a function for that unless you wrap your function inside an otter function that calls inner function to have a return value , but a simple lambda expression will save the day and you don't need to even define a function even if your command is a function like print( argument) you can't use () in your command= in your widget and you had to wrap the print inside a function otherwise print returns None but by using lambda you simply can use Button(......, command=lambda:print('string')) or command = lambda event:print(event). otherwise you got to use a higher order function (nested wrapper / inner) function
@sonamohialdin3376
@sonamohialdin3376 Жыл бұрын
Very helpful tutorial thank you very much
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
You're welcome!
@aniruddhadas2953
@aniruddhadas2953 Жыл бұрын
Thank You,Sir.
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
You're welcome!
@obiemmanuel354
@obiemmanuel354 Жыл бұрын
I love your contents a lot sir
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
So nice of you!
@obiemmanuel354
@obiemmanuel354 Жыл бұрын
@@DaveGrayTeachesCode I'm a beginner but hoping to get somewhere with your contents
@latesttrendzs
@latesttrendzs Жыл бұрын
Hey dave ! Just curious to know how coding teachers on KZbin like you get there knowledge from. Where they get to know so details of those coding languages?
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
Documentation, books, other articles and tutorials, and experience - no secret or shortcut here. I teach at university and the same applies there.
@ggff2269
@ggff2269 Жыл бұрын
Hey Dave, i am facing very slow compilation time in nextjs . A single change in file takes upto 60 seconds to appear and takes upto 2.5 gbs of ram. Also i am not using additional packages. I have noticed 1000s of devs facing same issue. How do you encounter this? It is very frustrating. It should have to be fast like vite. 😭😭😭 I really started hating it now but have to use it for SEO 😭😭😭😭
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
Duplicate question and this time on a Python video?? I answered under the appropriate Next.js video.
@netronominom2850
@netronominom2850 Жыл бұрын
Your videos are amazing Is it possible to make a tutorial for decentralized crypto exchange?
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
Thank you! I have not gotten into crypto coding. There are some good channels for that.
@johnaweiss
@johnaweiss 11 ай бұрын
1:34 My vscode doesn't do this conversion, so i'm guessing you have a formatter extension installed, such as "black". So that's not a native vscode behavior. 15:01 My vscode doesn't move imports to the top. Again, i'm guessing you have a formatter extension.
@oldgamer1299
@oldgamer1299 16 күн бұрын
Just in case you didn't resolve this, install autopep8 extension
@utinthein7274
@utinthein7274 Жыл бұрын
Thank you, sir
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
Welcome!
@JHunterJoe
@JHunterJoe Жыл бұрын
it re formatting because your not calling the lamda function right
@alexanderkomanov4151
@alexanderkomanov4151 Жыл бұрын
Thanks!
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
Welcome!
Python File Handling for Beginners
22:40
Dave Gray
Рет қаралды 22 М.
Подсадим людей на ставки | ЖБ | 3 серия | Сериал 2024
20:00
ПАЦАНСКИЕ ИСТОРИИ
Рет қаралды 554 М.
小丑女COCO的审判。#天使 #小丑 #超人不会飞
00:53
超人不会飞
Рет қаралды 14 МЛН
How Strong Is Tape?
00:24
Stokes Twins
Рет қаралды 33 МЛН
Please Master These 10 Python Functions…
22:17
Tech With Tim
Рет қаралды 232 М.
Master Higher Order Functions in Python - Full Course
38:42
map, filter & reduce 🙏 Namaste JavaScript Ep. 19 🔥
37:42
Akshay Saini
Рет қаралды 939 М.
Python: Lambda, Map, Filter, Reduce Functions
9:59
Programming and Math Tutorials
Рет қаралды 385 М.
Python Lambda Functions Explained
8:07
Tech With Tim
Рет қаралды 42 М.
Python While Loops & For Loops | Python tutorial for Beginners
23:11
Learn Python LAMBDA in 6 minutes! 🚮
6:50
Bro Code
Рет қаралды 10 М.
Python higher order functions 👑
6:28
Bro Code
Рет қаралды 39 М.
Python OOP (Object-Oriented Programming) Project for Beginners
30:19
The complete guide to Python
11:08:59
Clear Code
Рет қаралды 530 М.
Подсадим людей на ставки | ЖБ | 3 серия | Сериал 2024
20:00
ПАЦАНСКИЕ ИСТОРИИ
Рет қаралды 554 М.