Декоратор override
@overrideиспользуется для переопределения методов в классах-наследниках. Он позволяет указать, что метод в подклассе переопределяет метод базового класса.
Это может быть полезно для:
— Повышения читабельности кода, так как сразу видно, какие методы переопределены.
— Выявления ошибок: если имя метода в дочернем классе не совпадает с именем в родительском, будет выдана ошибка.
— Проверки типов аргументов: декоратор гарантирует, что типы аргументов совпадают с базовым методом.
#python#decorators
#python
I thought it was a trivial talk in the beginning.
But I quickly realized that I may know every each piece of the code mentioned in the video but the philosophy is what makes it exciting.
He talked about some fundamental ideas of Python, e.g., protocols.
After watching this video, an idea came to me. Pytorch lightning has implanted a lot of hooks in a very pythonic way. This is what makes pytorch lightning easy to use. (So if you do a lot of machine learning experiments, pytorch lightning is worth a try.)
https://youtu.be/cKPlPJyQrt4
🖥
Tip: You can use functools.reduce() in #Python to apply a function to all elements of the iterable set.
-----
Main channel: @repo_science
Coupons: @freecoupons_reposcience
-----
#Python
🖥
Test your typing knowledge in Python
Cool free project Python Type Challenger is a quiz where you have to write code. A good way to remember the basics of type hints (dictionaries, variables, return) and drill into the depths of the typing ocean (recursive, decorators, constructors, etc.).
🔗Link
-----
Main channel: @repo_science
Coupons: @freecoupons_reposcience
-----
#Python
tstock is a tool to easily generate stock charts from the command line.
tstock is a Python tool that allows you to easily generate stock charts from the command line.
Just enter tstock aapl to get a three-month candlestick chart of $AAPL in your terminal
▪Github
-----
Main channel: @repo_science
Coupons: @freecoupons_reposcience
-----