Комментарии:
Easy to understand
Ответитьin the first example if you did not use () between the walrus and the non equality operator then the lower priority of the walrus operator would cause a problem.
you can not use command := input() != 'q' ; unless (command := input) != 'q'
You look like "TechWithTeam" channel but older 😹
ОтветитьThere are many more good uses for the walrus operator. Some of the uses can be found in James Powell's vids...
ОтветитьBro your examples was awesome! thanks
ОтветитьThe problem is that lines tends to get too long.
ОтветитьIs this potentially something that a compiler could "figure out" at run time, and "optimize" what actually gets run toward the more efficient method of doing it?
Idk the formal words to use, I just know I've seen comparisons between python and C, and shown that certain things written in python that might look "not optimal" is actually interpreted by the compiler at run time and "figured out" and "made" more efficient by using the "actual" best method that should/could have been used
So this is basically a simple C++ assignment opeator, right?
ОтветитьAmazing!
Ответитьdon't tell me this is something that very little people know about, i have waited for this operator to be added in one of the languages since i programmed in Pascal!
ОтветитьAs for the last example, doesn’t Python interpreter optimise it automatically? As far as i know in C if you call function with the same argument for a few times its result is kept in memory. This optimisation is made by compiler
ОтветитьThe example with list comprehension was nice, I always wondered if this was possible without calling the same function twice, I will use it for sure
ОтветитьGood video 📸 👍
ОтветитьYo I just downloaded python 3.10.0 and I don't have any of the things you have. Like the side bar and the top bar. Is there something i need to set up to get those? I only have the black command console.
ОтветитьEpic
Ответитьare u lil supa?
ОтветитьThe most unknown is
A @ B
would prefer readability for future sanity purposes..
good tutorial though..tks
TIL the Walrus Operator is called the Walrus Operator because it looks like a Walrus. Literally had no idea what it's purpose was until this video.
Ответитьalso known as an assignment expression, amazing stuff
ОтветитьAlways teaching new stuff thanks Man
ОтветитьI've been using it for quite some time. This actually makes doing certain tasks easy.
ОтветитьAwesome tutorial
I have seen some code with colon in the function.
def my_func(int : something):
pass
If possible please make a video on what this is and how it works.
Thanks
Why are your other videos which are very important to us are not clear as this one?
ОтветитьI think its a nice Idea to know, but its the opposite of a pure "function" in the context of functional programming.
ОтветитьAnother interesting use case might be if you do list comprehension in combination with slow rest requests for example.
ОтветитьGuido von Rossum quit his gig as THE Python guy over the walrus operator. Not so much the operator itself as much as the bitter fighting that erupted over it's inclusion.
Part of the argument was that if == vs = could cause problems, imagine what kind of trouble you could get in with accidental assignments when you really just wanted a boolean result.
There were many in the community that felt non explicit assignments were as evil as the reviled 'Goto'.
Sorry I had to use language like that here, but sometimes just have to man up and know there were in the past forms of code worse than Stalin, Mao, and Hitler combined.
Funny thing is, the same peeps that loved goto hated recursion. Having a subroutine call itself was considered extremely naughty back in the day.
Wow this is very helpful specially for while loop. Thank you so much
Ответитьhello sir I want to create a ml+ai bot that operates a small machine to operate that machine it will learn from the videos ,but the problem is that how should I make it learn from the videos
ОтветитьGood Job!
ОтветитьIn K&R C: while ((c = getchar()) != 'q')
ОтветитьLuckily I knew abt that one.
Ответитьglad i knew this last two weeks ago.
ОтветитьI saw the walrus operator in the wild a few weeks ago and I couldn't find a decent explanation of its purpose in Python. I was pretty pumped when I saw this video pop up in my feed.
ОтветитьSir make a video on Google map clone from python.
Ответитьi remember reading about this when they added it and not understanding anything
ОтветитьNice I didn't even knew this one exists lol
Ответить