Type Hinting - Advanced Python Tutorial #6
Вставка
- Опубліковано 15 лют 2021
- In this video we talk about type hinting in Python.
◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾
📚 Programming Books & Merch 📚
💻 The Algorithm Bible Book: www.neuralnine.com/books/
🐍 The Python Bible Book: www.neuralnine.com/books/
👕 Programming Merch: www.neuralnine.com/shop
💻 Exclusive Content 💻
👥 Patreon: / neuralnine
🌐 Social Media & Contact 🌐
📱 Website: www.neuralnine.com/
📷 Instagram: / neuralnine
🐦 Twitter: / neuralnine
🤵 LinkedIn: / neuralnine
📁 GitHub: github.com/NeuralNine
🎵 Outro Music From: www.bensound.com/ - Наука та технологія
It's the first time I hear about this feature. I loved it! Definitively I'll start using it in my code. Thanks!
Any way to automate/run mypy programmatically? Like in a testing tool such as pytest?
I faced a case where I am defining a decorator and cannot use function as a hinted type for the parameter. What do to here?
this is actually useful, thanks!
What is the name of the song you are using in the intro?
Can you make a series on test driven development in python?
Thanks for sharing!
I worked with the list type hinting 🥳
Thank you for your content
Very nice video. I was wondering about exactly these things since a few days. Not sure why less than 1k likes! One added from me.
what kind of ide or editor are you using?
He is using Vim
Can you make a discord server. People can talk to you and ask questions first handed there and ask the questions can be answered by the community too
what about 2 type hints? like this
def add(x: float, y: float) -> int or float:
sum = x + y
if sum.is_integer():
return int(sum)
return sum
it is okay to use like that?
Yes, you can use union operation
you can use union but in general it's not a good idea since you have to check isinstance every single time...
In versions lower than 3.9 you can use typing for lists:
from typing import List
and then
test_list: List[dict] = []
what about 3.10?
@@Makwayne
No need to import typing library
at afar, I thought you were a 3d rendered model
Thank you
Thank you for your tutorials!
This is not at all advanced type hinting.
awesome
Can you made a single playlist of Python from beginner to advance.
As i m bignner so i m confused a little bit about where to go after one playlist.
Will it make the code faster?
No
could you do an async/await tutorial?
I have the same request. Btw, great videos on python. Loving the series.
BTW what's the use of this, if python is intelligent enough to sense the data types automatically. Does declaring types leads to performance boost?
I think it's used as a documentation of sort, to help the programmers understand more what the code does.
helpful for guys using docstring, and thus saves time for some formal documentation. maybe more.
thank u :0
`if type(myparameter) == ...` ?
Can you send your intro music please?
You Had a Good Thing - Herrera Lee Brandon
greetings from germany
Quick question, where do you live (Country/State)
Austria :)
@@NeuralNine I’ve been to Austria, my car broke down there and I had to stay overnight
Mannn... I love this channel. This content is awesome. I'm a developer myself. I just want to know that whether we can do like auto completion in python. Like if you start typing.. something. The most accurate thing shows in light color and when we press enter or tab, it filled automatically.
Auto-completion are mostly handled by the IDE and plugin installed on it. It's also called IntelliSense.
1st
Edit: @Aditya beat me.
Man, well done.
How do you change your typing position without mouse clicking?
I mean:
You are typing between codes and defs
But suddenly you do a shortcut and then
Booom!
You're typing in terminal!
What's that shortcut?
If you know, please say it in pycharm😅
Tnx
It's the Vim editor ^^
@@NeuralNine interpreation of " ^^ "???
@@samsabhaya6686 it's a smiley face bruh
Doesn’t work in python2. Not sure from which version of python3 it available. Thank you, for the video.
Thank you.
We can also do type checking with Pylance in VScode
In setting.json
```{
"python.analysis.typeCheckingMode": "basic"
}```
They can hint all they want. Single and not looking.
Which programming language should I learn after mastering python?
By the way nice tutorial :)
you should focus on ml or ds that's what python for learning many languages do not make change but mastering 1 do now learn what python work on your pre-existing skill instead of building new one
Ok, thanks
You can't master python
I can master you are noob
meh, such a trivial examples... Do you ever consider of using import typing ?
comment
Okay. A vim advice. If you're using the arrow keys, just don't. Stick with hjkl.
I know and you are totally right. But I am still not really comfortable using 10 fingers. I am practicing ^^
3rd. I am 3rd
This is not your best work. You should have gone into more complex things like items that can be None or why you will see type "List" and other times "list". How to do a dictionary or list of lists etc. Since this is a new and changing part of python you should redo this video.
It sucks. This guy is just nervous and unstructured.
okay steve
He's doing his best, but as a Python dev with 5+ years experience, this is cringe.
Thank you