Комментарии:
What about returns or inputs with numpy?
ОтветитьThx.
ОтветитьMy brain are brokenn ;-;
ОтветитьExtra thing I've learnt recently - you use the following to not do imports just for typing.
Also types surrounded by semicolons is a legit syntax and can be used for types which won't be imported during execution.
if typing.TYPE_CHECKING:
from my_module import MyClass
def myfunc(arg1: "MyClass"):
pass
Since 3.10 you can also do
----
def myfunction(myparam: int | float) -> int | float:
----
instead of
----
from typing import Union
def myfunction(myparam: Union[int, float]) -> Union[int, float]:
----
I'm using type hinting, but that's totally different level. Great
ОтветитьNice video.
Also, one of the best advantages of type hinting is that you can benefit from IntelliSense / code suggestions in the function body for a variable which is passed to the function as parameter.
Have you ever considered learning Rust? Nice video btw!
ОтветитьThank you very nice 👍🏼
ОтветитьThe intro is too loud in comparison to the rest of the video. This has been a problem for a long time now.
Ответить