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.
@Delirium1322312 жыл бұрын
I'm using type hinting, but that's totally different level. Great
@Hoco30Ай бұрын
Thanks you always have something that I needed.
@josefhamelink60492 жыл бұрын
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]: ----
@sasidharnaidu4507 Жыл бұрын
Yes, best thing is to make mypy kind of module inbuilt in standard lib
@yoavmor900210 ай бұрын
Optional isn't a fancy way to mark optional function parameters. It means the value can be None. Optional[T] is simply Union[T, None]
@xrdgx12 жыл бұрын
What about returns or inputs with numpy?
@arijanrahimic32102 жыл бұрын
Thank you very nice 👍🏼
@1202loki2 жыл бұрын
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
@aymancassim89442 жыл бұрын
Have you ever considered learning Rust? Nice video btw!