How could you beat that? What an excellent presentation of *args and **kwargs that always intimidated me at first sight. This lucid video exposition can make anyone BE ABLE to USE them comfortably in their CODE with the proper choice of expressions, functions and their arguments. BRAVO, KEEP IT UP, Dan. GOD BLESS YOU!
i popped in on the classic sites where newbies were ripped arg kwarg with a heap of lallaa information.. just as a play theme.. bad explainations indeed!
This just how strong python is . I just recently got into learning all this decorators and generators. It's amazing how you can interact with a function without even calling it. I don't if other languages support this kind of stuff.
I fully understand the starred expression in the "def" statement, but I'm not sure I understand why you are using starred expression in the calling (bar and super) statements.
HI BROTHER , dint get the wrapper thing in ur explanations ,can u pls make a video on wrapping the functions or modifying as u showed in 3rd example ,its a genuine request .regards
Does it anyone know how type args with mac keyboard, I can only see the suffix on top of the eight, that's multiple but to get a single and double args, I can't find it, help!
Is there an elegant way to avoid double initializing the self.color member (happens once in the super. __init__ and again in the derived class' __init__) ?
If you have your base class Class car: __init__(self, color, make=ford): Self.color= color Self.make= make Then you have your derived class Class van(car): Def __init__(self, capacity **kwargs): Super().__init__(**kwargs) Self.capacity=capacity You can use the super().__init__ to initialise the properties defined in the base class
Hey man, great video! massive help :) One little thing, you might want to look into getting a pop filter for your mic, or maybe a better one, if you already do. I'm listening with headphones and the audio slaps are a little distracting. Otherwise real good stuff :)
I've seen videos where they talk about Python idioms, and unwritten rules of Python. Things that make programs written in Python unique. I really don't know why we wouldn't want write code that can largely be understood by programmers fluent in any of the C like languages. I'll watch the video anyway, and see what I can learn from it.
The video is very clear and concise until around 4:19. I think you jump a little too fast, maybe you should explain these concepts slower? It would be very helpful.
I think this should read " this happens..." NOT "because they are called args and kwargs (those are just naming conventions)" but because of the * and **.
Hi. I'm trying to run this code and i am getting this error: "usage: SAm.py [-h] -i IMAGE SAm.py: error: argument -i/--image is required" from __future__ import print_function import argparse import cv2 parser = argparse.ArgumentParser() parser.add_argument("-i", "--image", required = True, help = "Path to the image") args = vars(parser.parse_args()) image = cv2.imread(args["image"]) cv2.imshow("Hello, World!", image) cv2.waitKey(0)
This was a playlist series meant for intermediate/advanced so that is obvious. and i think that is great and there should be more content for the intermediate/advanced since there is waaayy too much only for beginner beginners.
i always denied to understand args and kwargs i thought it was more complicated but after watching this video ...boom i got it very fluently
That's great to hear! Glad it was helpful.
it's glad to learn from you. you are amazing
many like to maintain * omg it is so complicated hehe ;) just as status thing..as MBs and Excel oh * it is so advanced.
@@ykpersson What?
One of the few clear, concise and efficient discussions of anything Python I've seen on YT Thanks, great job.
i'm a spanish native speaker, but speak and understand a little english, thanks to you i can understand this now.
I'm glad to hear that it helped!
How could you beat that? What an excellent presentation of *args and **kwargs that always intimidated me at first sight. This lucid video exposition can make anyone BE ABLE to USE them comfortably in their CODE with the proper choice of expressions, functions and their arguments. BRAVO, KEEP IT UP, Dan. GOD BLESS YOU!
Thanks for the kind words! I'm glad the video helped clear that up for you.
Great example into args and kwargs
Seriously bro, after 3 trash videos I found this diamond. Explained very well and precise as well.
Why does the mouse have motion blur? THAT'S SO FREAKING COOL!
went through quite a few bad explanations of this until I found your video. You, you're the one that got me over the args/kwargs hump.Thanks gj
You're welcome! I'm glad the explanation helped you! :)
i popped in on the classic sites where newbies were ripped arg kwarg with a heap of lallaa information.. just as a play theme.. bad explainations indeed!
Nice video bud, you made the piraty stuff arg , kwarg....with the parrot on my shoulder 🙂, so simple and easy to understand.
This just how strong python is . I just recently got into learning all this decorators and generators. It's amazing how you can interact with a function without even calling it. I don't if other languages support this kind of stuff.
Super handful. Thanks for sharing.
I fully understand the starred expression in the "def" statement, but I'm not sure I understand why you are using starred expression in the calling (bar and super) statements.
HI BROTHER , dint get the wrapper thing in ur explanations ,can u pls make a video on wrapping the functions or modifying as u showed in 3rd example ,its a genuine request .regards
Thank you very much for this video :) It is helpful for me
The names sound like klingon to me.
Excellent explanation. Thanks!
Does it anyone know how type args with mac keyboard, I can only see the suffix on top of the eight, that's multiple but to get a single and double args, I can't find it, help!
Really great explanation, thank you
Very well explained..
Is there an elegant way to avoid double initializing the self.color member (happens once in the super. __init__ and again in the derived class' __init__) ?
If you have your base class
Class car:
__init__(self, color, make=ford):
Self.color= color
Self.make= make
Then you have your derived class
Class van(car):
Def __init__(self, capacity **kwargs):
Super().__init__(**kwargs)
Self.capacity=capacity
You can use the super().__init__ to initialise the properties defined in the base class
Can't we use "list" as a formal parameters instead of "Variable Arguments"
Great video. Please execute more examples - both working and common pitfalls
Glad you liked the video! Thanks for the suggestion. :-)
what is python runtime?
Hey man, great video! massive help :) One little thing, you might want to look into getting a pop filter for your mic, or maybe a better one, if you already do. I'm listening with headphones and the audio slaps are a little distracting. Otherwise real good stuff :)
I'm glad you are enjoying it! Thanks for the feedback on the mic.
why we use ',' operator while assigning EX: e,=ax.plot() or return e,
Shorthand to make a tuple.
>>> a = 1
>>> type(a)
>>> a
1
>>> b = 1, # notice the comma
>>> type(b)
>>> b
(1,)
Python is amazing !
thanks, well explained ....
I've seen videos where they talk about Python idioms, and unwritten rules of Python. Things that make programs written in Python unique. I really don't know why we wouldn't want write code that can largely be understood by programmers fluent in any of the C like languages. I'll watch the video anyway, and see what I can learn from it.
Why you don't run your code in the examples? The last 3
Didn't get it what's happening in 3 example ;___;
I get a syntax error for the AlwaysBlueCar(Car)
probably because you are using 'def' instead of 'class'
The video is very clear and concise until around 4:19. I think you jump a little too fast, maybe you should explain these concepts slower? It would be very helpful.
1:13 Why not print args and kwargs unconditionally? Then you will see what you get when the caller doesn’t specify anything for them.
Write pythonic python. Become a better pythonian. Join the pythonious revolution!
Wonderful
Helpful
excuse me, why `data = {**notification.get_data(), **app_id_obj}
` getting error on my code?
Great explanation!
Thanks!
Which editor u r using in this video?
I mainly use Sublime Text
@@realpython Thanks for reply. I really appreciate your work Sir. Its super cool 😍
The example is at 3:28.
thank you uncle ben
3:39
Dan: ... The function DIDN'T really ASK for any of these ARGUMENTS (**kwargs) to be passed in, but it was able to handle them.
6:26
Dan: Here's another example: ... this method can also be helpful for subclassing...
3:45
Dan: ... and Python RUNTIME collected the EXTRA arguments INSIDE this args tuple ...
Really nice, waiting for pytest session
Thanks for the kind words! :)
I think this should read " this happens..." NOT "because they are called args and kwargs (those are just naming conventions)" but because of the * and **.
AARg and KWARg
Thank you!)
You're welcome!
no examples?
Hi. I'm trying to run this code and i am getting this error:
"usage: SAm.py [-h] -i IMAGE
SAm.py: error: argument -i/--image is required"
from __future__ import print_function
import argparse
import cv2
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--image", required = True, help = "Path to the image")
args = vars(parser.parse_args())
image = cv2.imread(args["image"])
cv2.imshow("Hello, World!", image)
cv2.waitKey(0)
"Args (huh) Yeah! What is it good for?"
Abolutely everything
Think of foo function as a bill passing through Congress and Senate, adding porks.
So mostly no then?
with great power comes great electricity bill
Fucking google can read my mind
I'll never get this lol
Cringe
Total wastage of time
0:26 cringe
too complicated too fast for a beginner
This was a playlist series meant for intermediate/advanced so that is obvious. and i think that is great and there should be more content for the intermediate/advanced since there is waaayy too much only for beginner beginners.
Brooding Nightmare You don’t use this as a beginner.
2:08 stop