Комментарии:
return len (cls.dog)
why do we need to know the length of the dog? i dont get it here
For static method, why
for _ in range (n), what do the underscore here stands for? And why is it use?
Activate your windows😀😀🤣🤣😂
ОтветитьI just read the whole comments and discovered I’m the only one that didn’t understand the concept🥺🥺🥺🥺
ОтветитьIncredibly well explained, with use cases and all. Thanks for taking the time to do this, great work!
ОтветитьFinally I know why they have created @staticmethod and how we are using them all the time.
ОтветитьGreat video as always, however, I would appreciate it if you could explain decorators in more simple terms/explain decorators more in depth.
ОтветитьFucking way more easier with this guy. U rock man
ОтветитьThis example with dogs does not make sens.
Ответитьdude you have 666k subscribers
ОтветитьI am in love with your videos. I dont know if its how you suppose to use it, but i use cls to call staticmethod from my class without writing my class name, like: cls.somemethod(x) instead of MyClassName.somemethod(x)
Ответить❤️❤️
Ответитьdisplay object variable stored in Global variable.
print(Dogs.dogs[0].name)
print(Dogs.dogs[1].name)
THANK YOU SO MUCH!
ОтветитьThank you for making these! I really don't know why, but when I sit down and try it just pops to my head all the gaps in my knowledge. It's almost magical. Thank you.
ОтветитьYour Keyboard just gives the dopamine
ОтветитьYou didn't active windows?
ОтветитьWhy sometimes do you declare a class as for example class Dog(): with brackets and then also class Dog: and no brakets?
ОтветитьNice video series.But i want to know why he was feeling sleepy at the time of recording.Thats just disgusting to hear while he was speaking with that sleepy tone.I recommend to change your tone man
ОтветитьDo you have to use decorators at all?
ОтветитьFor those confused as to why his class variable "dogs" of the class "Dog" keeps returning locations, I think Tim might have made a mistake.
Change "self.dogs.append(self)" to "self.dogs.append(name)"
He was saving memory locations in the dogs array not values at the dogs array.
I was trying to figure out how to make those Dog names print out, and figured out the simplest way to do that was to just change what was stored in the dogs array then to turn the locations into values.
Tim is far more experienced than me and might have a better way of doing this. And it was intentional.
“Actívate Windows” 😂
Ответитьtim = Dog("tim")
jim = Dog('jim')
print(Dog.num_dogs())
Dog.bark(Dog.num_dogs())
but this does work, the dog barked 2 times :D, you said that it will not work :D
really nice explanation, thanks Tim
Ответитьnice I finally understand those properties.Thanks!
Ответитьhi Tim, ı find your videos really helpful thank you for that but here is the thing ı struggle is that you speak a bit faster
ı'm not a native speaker so it makes a bit harder for me to listen and understand when ı slow it down it sounds weird too so could you please try to speak a little bit slow
Why do you have to use the @staticmethod decorator? As I noticed it doesn't make a differnce if you omit it. Also with the classmethod, you can just leave out the decorator, remove the 'cls' from the args, and replace 'cls' with 'Dog' when returning. What I noticed in this case is we can't call these methods on instances. Is it the reason why we use decorators?
ОтветитьThis was really useful. A little bit hard to follow, but I was messing with my code and testing things and I better understood.
For example, I created some dogs and I wanted to know the names of all the dogs, so I used a for loop to get them like this:
# in my case I changed Dogs to Perros and the class variable dogs to perros
for p in Perro.perros:
print(str(p.name))
juanita
pedrito
excellent video!
ОтветитьSir please tell me
About the statement you wrote
Self.dogs.append(self)
How did that worked for both objects
great stuff
Ответитьcould you please explain the decorators.
ОтветитьWhen I first learned object orientated programming. I was told that you have one plural class and one singular class.
But you have the plural "object" in your singular class, I have no problem with that, I just want to know your thoughts about that. I think that you do a great job with your videos and as a programmer for many years I feel that I don't have to listen to people talking about Python, or other programming languages, as if we don't know anything about programming.
So with @classmethod you can create bassically "subclasses". 🤔
Ответитьyour title spelling "Mehtods"
ОтветитьGreat series. Problem with Windows activation? Join Linux :)
ОтветитьQuestion!
Do all my class methods need @Classmethods above them or can one @Classmethod be placed above all the class methods? Loving your videos
Question: I made a class in a project I'm working on right now.
I made a method within my class that should take one of the attributes that initialized and according to their value it decide how to work.
for example:
1. class One_Or_Zero(object):
2. def __init__(self, num):
3. self.num = num
4.
5. def process(self)
6. if self.num = True:
7. return 1
8. else:
9. return 0
10.
11.
12. yoyo = One_Or_Zero(True)
13. print(yoyo.process())------------------output-------------------------------------
1
Now Pycharm suggest me to convert the process method to property.
If I do, PyCharm adds @property above the method. I wonder what's meaning
Thanks.
You are a great teacher! Congratulations and Thank you!
ОтветитьGreat vid but you misspelled 'methods'
ОтветитьThis series definitely deserves much more views!
ОтветитьThanks for clearing the concepts, about the static and class methods, I found it very useful to understand the concept correctly, you used a good example in this code sir.
Ответить