@staticmethod / @classmethod (beginner + advanced) anthony explains #294

preview_player
Показать описание
today I walk through what the `staticmethod` and `classmethod` decorators do -- I also show roughly how to implement them as descriptor classes

==========

I won't ask for subscriptions / likes / comments in videos but it really helps the channel. If you have any suggestions or things you'd like to see please comment below!
Рекомендации по теме
Комментарии
Автор

Please explain for what reason use the classmethod? Static is obvoius, but what are the usecase for classmethod?

marsma
Автор

I have a very love-hate relationship with Python but lately I have been just obsessed with decorators. I kind of love the concept and I wish a similar thing existed in other languages. I find the syntax pretty and quite useful honestly

tompov
Автор

do a 'descriptor in depth'! why do they exist? what makes a class a descriptor? and why do they exist, i.e. what do they allow you to do that any other python core features don't let you do? conveniently?

sadhlife
Автор

Can you add more details on usecase, I know class method can be used alternative constructor. What are else use cases

expirytrader
Автор

so `property`, `classmethod` and `staticmethod` are present globally, but only really make sense when being used inside a class, right?

sadhlife
Автор

5:10 Are you grep through the git repositories?
help(classmethod) show it too)). But your example with 'all-repos-grep' is interesting but not clear.

RuslanSkiraUkraine