I know these are a little older but having done some course with others, I find yours very organised. The choice of examples are very good, perhaps because you have taken time to write a book about it. It does show. You can I am on the play list till the last course. Thank you
Dan, a Margherita pizza has 3 ingredients besides the dough representing the Italian flag colors. Red Tomatoes, White Buffalo Mozzarella, and Green Fresh Basil. Great series on Pyrhon!
I don't really agree with your static methods can't modify state claim. See below: class Pizza: __some_state = 0 @staticmethod def _static_foo(): Pizza.__some_state += 1 If I am not mistaken, @staticmethod came first but was insufficient because it didn't deal with inheritance well. We got @classmethod to deal with this shortcoming. I really don't see the need for @staticmethod anymore and I believe it was only left for backwards compatibility.
A good use of static methods is to create a utility class, ie MyStringUtils, which would contain only static methods that provide custom methods for calculations or manipulations for a particular type of item.
One thing that id love to see answered is why use a class method over a static method? Do you really need access to cls to instantiate the class? You can return an instance of the class from a static method, so what is the real benefit of the class method??
my number one error message (during my degree) in projects in java was related that I was using static if it was not allowed or vice versa didn't used a static method when needed lol
bewitching one mate i'm looking forward to watch all the concepts from ur channel, do u also update ur videos in udemy regarding framework,appium with python actually m looking forward to buy ur course.
Hi. there. My name is Randy. I really appreciate your efforts in delivering all those high quality tutorials, I benefit from it a lot. I'd would really want other people in China to know your channel too. Unfortunately, the GFW blocks us from visiting website like TH-cam, Facebook, twtiter ,etc. With your permission, I would really like to share your videos and translate them into Chinese then put them on a Chinese Website. If, by any chance, you don't mind, please let me know.
ok, video is great but hear me out. i opened youtube just to search differences between classmethods and staticmethods. this video was waiting for me on the front page. what kind of sick algorithm is this😱
hello dear Dan overwhelming tutorial - very helpful. You have great talents to introduce into difficult concepts. I really like your explanations on the different methods of Python OOP. One question though can you put togehter the most important infos into a cheatsheet - a Summarizing Cheat Sheet to download would be fantastic. Above all: many thanks for the quick reply. you did a fantastic job explaining these concepts of using different methods in Python. I am learning to code and your introduction helps me to fully grasp the ideas. keep up the great work - it rocks!! best regards martin
Hello, Can someone explain me this? At some point, you said that we can call the method without the instance, but saying that cls created instance, so whats the point? I mean, it's illusion isn't it?
Great intro there Dan! Your book 'Python Tricks' is a real find. Got me scrambling my head to find a good usage of a staticmethod. For a little project of mine, github.com/veena-LINE/creditcalculator/blob/master/creditcalculator.py that accepts args via command line, I used a staticmethod to display usage info (a static) when the parameters are insufficient. If there isn't sufficient command line params:: display staticmethod that displays its usage. else: Object is instantiated. Further processing.. What are your thoughts on that?
Uh. I will never learn it cause I can never understand it. I dont even see any use of classes, it instantly changes clarity of the entire code to zero. What the hell is class state and where would I need that? Whats the simple role of @staticmethod and @classmethod? Why everything about it has to be so extensive and vogue? Classes in script language like python is a bad idea, it was meant to be simple but even JS has better designed classes.
too many jokes.....and showing off becasue he has an italian wife....listen mate ....computer guys just want the answers..not all the showbiz...get on with it and stop being a muppet.
Hi Dan! Italians are watching and approve your spelling! Keep up the good work!
You explained that very simply in less than 15 minutes. You are a wizard.
Dude - these tutorials are freakin' awesome. Keep it up. I am learning all sorts of stuff. And we really appreciate them!
"This isn't about cheese, this is about Python"
Fantastic. Great tutorial, Mr. Bader!
I know these are a little older but having done some course with others, I find yours very organised. The choice of examples are very good, perhaps because you have taken time to write a book about it. It does show. You can I am on the play list till the last course. Thank you
Dan, a Margherita pizza has 3 ingredients besides the dough representing the Italian flag colors.
Red Tomatoes, White Buffalo Mozzarella, and Green Fresh Basil.
Great series on Pyrhon!
great examples for class methods. I never really find a use for them but might have to rethink.
This was actually a really great explanation and a good prosciutto spelling. Thank you!
Ive come to this series in 2019 and it looks absolutely FANTASTIC thanks for sharing this with the world mate!
Very nice explanation. There are some basic things that we skip and forget from time to time. Great video(s) Dan. Cheers!
Great work on explaining these three concepts! Keep it up! 👍
Very good explanation
I don't really agree with your static methods can't modify state claim. See below:
class Pizza:
__some_state = 0
@staticmethod
def _static_foo():
Pizza.__some_state += 1
If I am not mistaken, @staticmethod came first but was insufficient because it didn't deal with inheritance well. We got @classmethod to deal with this shortcoming. I really don't see the need for @staticmethod anymore and I believe it was only left for backwards compatibility.
Simple and clean!
A good use of static methods is to create a utility class, ie MyStringUtils, which would contain only static methods that provide custom methods for calculations or manipulations for a particular type of item.
Awesome and thank you!
One thing that id love to see answered is why use a class method over a static method? Do you really need access to cls to instantiate the class? You can return an instance of the class from a static method, so what is the real benefit of the class method??
love that idle. what is it? the box with autocompletion is gorgeous.
Yes! Was looking for a video like this
I'm glad you enjoyed the video!
Really superb teaching.
Learnt @classmethod and
@staticmethod
Thanks for this wonderful video.
You're welcome!
my number one error message (during my degree) in projects in java was related that I was using static if it was not allowed or vice versa didn't used a static method when needed lol
Great video, keep it up!
Thanks!
bewitching one mate i'm looking forward to watch all the concepts from ur channel, do u also update ur videos in udemy regarding framework,appium with python actually m looking forward to buy ur course.
@RealPython what do you think about it?:
class A:
x = 1
@staticmethod
def change_static():
A.x = 2
@classmethod
def change_class(cls):
cls.x = 3
>>> A.x
1
>>> A.change_static()
>>> A.x
2
>>> A.change_class()
>>> A.x
3
Really useful, thank you!!! I just subscribed to your channel @Real Python
Hi. there. My name is Randy. I really appreciate your efforts in delivering all those high quality tutorials, I benefit from it a lot. I'd would really want other people in China to know your channel too. Unfortunately, the GFW blocks us from visiting website like TH-cam, Facebook, twtiter ,etc. With your permission, I would really like to share your videos and translate them into Chinese then put them on a Chinese Website. If, by any chance, you don't mind, please let me know.
Daaaaaaaaan ... you are the best
Thanks!
Thank you!
That was nice! Thanks!
You're welcome! :-)
Thanks, bro! It helped.
Awesome!
Thanks!
very nice
beautiful, thanks
You're welcome!
Well explained
Thanks a lot!
You're welcome!
ok, video is great but hear me out.
i opened youtube just to search differences between classmethods and staticmethods.
this video was waiting for me on the front page.
what kind of sick algorithm is this😱
Nice !!!!!
Thanks!
Practically speaking, Isn't @staticmethod just a regular function?
Hi Dan, How can I make my python console having the auto-completion as like yours? Thanks!
Started feeling hungry!
hello dear Dan
overwhelming tutorial - very helpful. You have great talents to introduce into difficult concepts. I really like your explanations on the different methods of Python OOP. One question though can you put togehter the most important infos into a cheatsheet - a Summarizing Cheat Sheet to download would be fantastic.
Above all: many thanks for the quick reply. you did a fantastic job explaining these concepts of using different methods in Python. I am learning to code and your introduction helps me to fully grasp the ideas.
keep up the great work - it rocks!!
best regards martin
That's great to hear you found the tutorial helpful! :-)
hi Dan - which editor do you use? Keep up the great work - it rocks!!!
I mainly use Sublime Text Editor
What terminal theme it is?
Don't you think **kwargs could be a good idea to use for complicated or lot of arguments in constructors instead of using a classmethod?
very awesome explanation!
is there one for python 2?
Hello,
Can someone explain me this?
At some point, you said that we can call the method without the instance, but saying that cls created instance, so whats the point?
I mean, it's illusion isn't it?
what font is that?
Awesome teaching! You should consider doing a a Udemy course! Subscribed in a heartbeat.
Thanks! :-)
Hello
I did the same "return f'pizza({self.ingredients})"
but it keeps showing error"invalid syntax" on that line
is your python version 3.6 or later?
@@wlxxiii I'm not sure about that, actually I ran that on online compiler(onlinegdb)
I would totally put pineapple on the margharita just piss my wife off.
9:49 you explained that is a classmethod, but you said staticmethod instead.
What you mean class state
Great intro there Dan!
Your book 'Python Tricks' is a real find.
Got me scrambling my head to find a good usage of a staticmethod.
For a little project of mine,
github.com/veena-LINE/creditcalculator/blob/master/creditcalculator.py
that accepts args via command line, I used a staticmethod to display usage info (a static) when the parameters are insufficient.
If there isn't sufficient command line params::
display staticmethod that displays its usage.
else:
Object is instantiated.
Further processing..
What are your thoughts on that?
what's IDE you used bro ?
I mainly use Sublime Text.
so, what'is package you used to coding Python bro?
Anaconda + SublimeLinter, that's the best combo I found. More details here -> SublimeTextPython.com
Hey. Russian bloggers make their lessons based on your content
isn't it matzarilla not moseorilla?
Not sure! But it tastes great!
Uh. I will never learn it cause I can never understand it. I dont even see any use of classes, it instantly changes clarity of the entire code to zero. What the hell is class state and where would I need that? Whats the simple role of @staticmethod and @classmethod? Why everything about it has to be so extensive and vogue? Classes in script language like python is a bad idea, it was meant to be simple but even JS has better designed classes.
Literally did not understand a single word of what you said.... zero context to any of what you are explaining. All the how but none of the WHY.
too many jokes.....and showing off becasue he has an italian wife....listen mate ....computer guys just want the answers..not all the showbiz...get on with it and stop being a muppet.