Комментарии:
Where is the data stored?? This looks like quantum physics but for computers. This is quamputing
ОтветитьObviously intended positively and think this to be true somehow
AI's Closure - outer function (responses variable)
Corey's Closure - inner function (here it is)
:)
Thank you!
So now we have to watch "logging" in python? 🙄
ОтветитьOne of my Uchicago's professor recommended this channel for learning python, until i really watched and followed along, i never know tutorials here are so invaluable. ❤Corey is a fantastic teacher in this
Ответитьdude this is actually crazy how easy it gets when you understand it
Thank you.
Thanks for another great video that explains the mechanics, not just syntax. What I would like to understand better: What are real world use cases in which to use closures. Or in other words: In my problem solving efforts before writing code, what are patterns that call for closures.
ОтветитьYour example doesn't work.
Ответитьprint_h1('Test Headline!') = html_tag('h1')
This works under Sublime ans doesn't under VS Code.
I don't know why. The same Python version..
The way I prefer to remember this concept:
The outer function "closes over" an inner function, therefore it's a closure. While doing so, it "injects" its local scope into the function being closed. So the function that is returned will be executed with the injected state every time it is called.
I have recommended your channel to a lot of my colleagues over the years
ОтветитьYou are the best, I have been following your channel for years, and I always come back to your videos.
ОтветитьMind blown
ОтветитьAre closures the same in low level languages like c++ or rust? I never heard somebody mentioning usage of closures or callbacks in those kind of languages. Like there is something akward about it.
ОтветитьSo closures and first-class functions are basically the same thing right?
ОтветитьSECURITY
ОтветитьI have no words to thank you because this was a very tricky concept that I was trying to learn for last 2 days in dart and your video make me able to understand what exactly closure does, thank you so much
Ответитьwell explained and easy to understand for beginners
ОтветитьWikipedia sucks, Coreyshaferpedia rocks
ОтветитьGreat explainer
ОтветитьThanks was very very helpful.
ОтветитьSo are methods that have a free variable synonymous with closures?
ОтветитьCouldn't the wrapped functions be done just as easily by having additional parameters in a normal function? I think more complex examples would have been good to really see the utility of closure and decorated functions.
Ответить2022
ОтветитьThank you for the video. I am grateful for your time and contribution. Kind regards, Akira.
ОтветитьGreat video :)
ОтветитьI like the way you explain complex topics in a easy way.
ОтветитьFor all the SQL folks out there, it's like a child stored procedure that remembers its input and output and is ready to return that input and output to its parent at a moment's notice......without having to define output parameters in the child sproc.
ОтветитьTop Video,really focuses on understanding.
Ответитьwhen i executed hi_func = outer_func(“hi”) , i got result hi instead of address. What is going on?
ОтветитьI get how closures work but I don't see any real use of this concept... Maybe someone has one?
Ответитьsuper cool video, finally understood closures :)
ОтветитьIs my understanding correct? - Closure remembers the variables that exist in the enclosing scope, since those variables stop to exist when the outer function is executed. Now that the variables are remembered, they can be passed to the inner function, so that the inner function can work properly. Thanks in advance
ОтветитьReally great video man. Helped it click for me with deeper understanding where other videos couldn’t. Thanks!
ОтветитьBrilliant selection of examples, you made me understand! Now I feel I am evolved!
ОтветитьWhat problem do closures solve? I feel like closures add more complexity than they are worth and sacrifice code readability, troubleshooting, and maintenance.
ОтветитьAwesome!
ОтветитьSuch a helpful video! Here's a heuristic I used to help understand why we need to set my_func = outer_func() in order to execute the inner function instead of just calling outer_func().
outer_func() (in the second example where we return inner_func instead of inner_func()) returns, but does not execute a function. If you want to execute it, you might want to call outer_func()() but that syntax is illegal, so we set outer_func() to the variable name my_func so we can call my_func() with just one set of parentheses. Thinking of an illegal function with double parentheses and re-writing it using legal syntax helps me conceptualize why we use my_func.
Every video, got to watch another video. This is an endless while loop
Ответитьclosure = تعني بالعربية الفناء الأمامي وفي المعنى هنا تعني فناء المتغيرات المشاع اي closure of free variables on the outer function
الغريب في هذا المفهوم هو عندما تمسك الدالة الخارجية يتم تعيين المتغير بالدالة الداخلية وهذا أمر جد غريب
What's the purpose of closures? Wouldn't it be simpler to just pass multiple variables so that the inner function isn't required? For example, you could just pass 'tag' and 'msg' as arguments instead of creating the inner function
ОтветитьWhat if outer_func() has 2 inner functions inner_func1() and inner_func2() with parameters
OR
3 level nested function?s
Guys please someone clear my doubt why variable my_func get equal to inner_func 😭
ОтветитьCan someone explain how return value get equal to that variable??
ОтветитьAnother great video! Thanks again.
ОтветитьAmazing Explanation bro
ОтветитьCorey's videos are always excellent - his explanations are clear and he makes complex topics very accessible. Thank you!
Ответить