Intermediate Python Tutorial #5 - Lambda Functions

Поділитися
Вставка
  • Опубліковано 24 сер 2024

КОМЕНТАРІ • 61

  • @eletronicaautomotiva2956
    @eletronicaautomotiva2956 5 років тому +28

    perfect teaching method for foreigners. hugs from Brazil

  •  4 роки тому +44

    You have much much better explanations than I found written.

  • @Kennsenn5
    @Kennsenn5 2 роки тому +2

    Man dude you have a way with explaining material, so that everyone can understand.

  • @BM-vz2nb
    @BM-vz2nb 3 роки тому +9

    Your videos are really clear and to the point! Thanks Tim!

  • @ChaosArtist
    @ChaosArtist 3 роки тому +2

    Thanks for the explanation and example of lambda with the map function.

  • @brniesenders4288
    @brniesenders4288 3 роки тому +4

    Thanks for the light bulb moment Tim! Cheers man. Love your videos, I'll spread the good word.

  • @CharlesBLim
    @CharlesBLim Рік тому +1

    Thanks for that simple yet easy to digest explanations about lambda.

  • @reginaldcobb4356
    @reginaldcobb4356 4 роки тому +7

    Very helpful tutorials. I like your teaching style. Thank you so much for taking the time to create them and for sharing.

  • @melidobello1330
    @melidobello1330 4 роки тому +8

    This one was amazing!

  • @RameenFallschirmjager
    @RameenFallschirmjager 3 роки тому +2

    You has come a long way dude!

  • @ThisisFate
    @ThisisFate Рік тому

    Always had trouble understanding this when written, great video, very straightforward explanation

  • @alex-sd
    @alex-sd 2 роки тому +1

    Wow.... best explanation for this function! Thanks so much!

  • @galvinbeats
    @galvinbeats Рік тому

    So helpful...you won a subscription

  • @technicalgaming4936
    @technicalgaming4936 2 роки тому +1

    Thank you helped so much

  • @round.maiden1863
    @round.maiden1863 2 роки тому +1

    Very well explained. All clear to me now.

  • @user-pk8hn6zw8m
    @user-pk8hn6zw8m 3 роки тому +1

    great tutorial 10/10. will definitely be binging these later

  • @phillippage8127
    @phillippage8127 Рік тому +1

    I've always struggled to explain this while mentoring other engineers. Nice video and great examples. I think I was overdoing it.

  • @Peter-ur3yy
    @Peter-ur3yy Рік тому

    Top class video

  • @nabilnabil1824
    @nabilnabil1824 3 роки тому +1

    thanks a lot , you are great in explaining about lambda

  • @willjohnson4579
    @willjohnson4579 3 роки тому +2

    As long as your function doesn't need a while loop inside, you can use a list comprehension to nest if/else blocks and for loops indefinitely. All you need to do is either unpack your list (eg x,y=myfunc(args)) or if you only return one output simply set the index to zero (eg [blah if blah == criteria for blah in iterable][0]).
    However, I wouldn't recommend it.

  • @THUNDER52
    @THUNDER52 Рік тому

    This is why I ask people not computers because the information may be the same but the way it’s delivered isn’t.

  • @maximusorca4146
    @maximusorca4146 Рік тому

    Thank you again Tim, Your videos are awesome

  • @ReisFamilyWebsite
    @ReisFamilyWebsite 3 роки тому +2

    Greeeeat video! Well explained, and with great examples. Thank you!

  • @aryanbhatia6992
    @aryanbhatia6992 5 років тому +4

    love your videos , can you make a tutorial series on making pacman using pygame ??

  • @sviat7489
    @sviat7489 2 роки тому

    MAAAAAAAAN, you're the best! just subscribed

  • @goncalocartaxana
    @goncalocartaxana Рік тому +1

    AHHHHhhHH the white background!

  • @Lomniko
    @Lomniko 3 роки тому +1

    What a great tutorial, thanks mate!

  • @orangasli2943
    @orangasli2943 Рік тому +1

    When I learn in c++
    There is capture clause to select variables from the surrounding scope i.e maximum is the first layer outside of it's declaration..
    And we can choose whether to take it by reference or by value..
    On the other hand when I learn kotlin,
    We wanted to use lambda when we need to pass the last argument to a function..
    Also in kotlin I think there are so many abusing lambda function that make us compulsory to use them because it is built into the languange

  • @rishabkumar9578
    @rishabkumar9578 4 роки тому +1

    Thank you Tim

  • @mayankrathore8721
    @mayankrathore8721 3 роки тому

    Well that finished quick. Thanks

  • @mr-engin3er
    @mr-engin3er 4 роки тому +4

    The recommendation in PEP-8 you are running into is:
    Always use a def statement instead of an assignment statement that binds a lambda expression directly to a name.
    Recommended:
    def f(x): return 2*x
    Not recommended:
    f = lambda x: 2*x
    I use vscode with auto pep8 . And whenever i save my program it'll convert lambda to a function.
    So is it not recommended to assign a variable to a lambda function?

    • @grayfaux_
      @grayfaux_ Рік тому +1

      Great video Tim. Yes Dheeraj, the appropriate use of lambda in a single variable environment per PEP 8: E731 states.
      powers = lambda x, y: x ** y is wrong though it will work.
      def powers(x, y): return x ** y would be correct.
      I would argue however, that a more verbose solution is always more useful where lambda is not required. New programmers will often try to fit as much code into one line as possible because they are told it's "cleaner and easier to read."

  • @urhenerdna1967
    @urhenerdna1967 2 роки тому

    great. thanks Tim!

  • @sujahathsiddeek378
    @sujahathsiddeek378 2 роки тому

    Better explanation

  • @sarthak1314
    @sarthak1314 Рік тому +1

    Really helpful video to understand Lambda functions quickly. However the mechanical keyboard loud noise is quite annoying.

    • @easydatascience2508
      @easydatascience2508 Рік тому

      You can see mine also. Very detailed Python tutorials in the playlist. One R tutorial too, by the way.

  • @eswarspython2743
    @eswarspython2743 2 роки тому

    Nice explanation

  • @somnvm37
    @somnvm37 Рік тому

    so, lamda is just a 'one line function' and the only action it does, it returns you a value immidiately

  • @adventuresoftext
    @adventuresoftext Рік тому

    Dang, I've always seen lambda but never really understood what use it could have for my Python open world text adventure, now my eyes are open lol. Time to see if I can find better use cases for this in some of my calculations.

  • @THUNDER52
    @THUNDER52 Рік тому

    I have autism so I take everything literally and “anonymous function” is useless to me, so these examples are PERFECT for me to learn and comprehend wtf is going on

  • @kapibara2440
    @kapibara2440 11 місяців тому

    My next months will totally be dedicated to Python given that there is such a comprehensive teacher like Tim out there. Thank you ☺

  • @yayeetxd6137
    @yayeetxd6137 3 роки тому

    nice vid.

  • @wongkingshun
    @wongkingshun Рік тому

    newList = list(filter(lambda x: x%2==0, a))

  • @adityasaini495
    @adityasaini495 3 роки тому

    Thank you bro!

  • @user-tl8ny2jk7h
    @user-tl8ny2jk7h 3 роки тому

    thank you!

  • @user-mf8nu5qe5f
    @user-mf8nu5qe5f Рік тому

    Are python lambdas similar in C#?

  • @gtdt5666
    @gtdt5666 3 роки тому

    Thanks

  • @_Cartographer_
    @_Cartographer_ 3 роки тому

    I've seen people calling normal functions through lambda functions in places were it's not possible to call the normal function directly. Why do people do that and why does lambda work in these sort of situations ?

  • @a7lakoura227
    @a7lakoura227 2 роки тому

    so lambda functions are like arrow functions in javascript in their utility?

  • @alok7485
    @alok7485 5 років тому +3

    Also please tell about Tensorflow in Python and Pygame

    • @TechWithTim
      @TechWithTim  5 років тому +4

      I have many videos on my channel teaching pygame...

    • @alok7485
      @alok7485 5 років тому +6

      What about Tensorflow dear sir please tell Tensorflow

  • @thndr_5468
    @thndr_5468 3 роки тому +1

    I'm still kinda confused why exactly anonymous functions are useful. When are they a better option than defining a function?

    • @fieldmartan4426
      @fieldmartan4426 3 роки тому +1

      as stated in the video, they're a cleaner way than defining a new function, why create an entirely new function to do something making a messier file when you can use a Lambda instead?

  • @dabkolay
    @dabkolay 3 роки тому

    Basically JS arrow functions right?

  • @jhassee
    @jhassee Рік тому

    commonet

  • @5pm_Hazyblue
    @5pm_Hazyblue 2 роки тому +1

    activate windows

  • @alok7485
    @alok7485 5 років тому +2

    Please tell about Pygame please i beg you

  • @zstar8397
    @zstar8397 Рік тому

    YO just wanna say to believe in Jesus for he loves u so much that that he died for u so u can have a relationship with him. Believe in him
    and ask him for forgiveness of your wrongdoings