that is the clearest and simplest explanation for type hints. thank you man.
@austinhaider1056 жыл бұрын
I've learned everything I know about Python from KZbin and your videos are some of the best I've come across. I appreciate the amount of detail you go into about every topic; keep it up!
6 жыл бұрын
Thank you!
@francescofaccia3 жыл бұрын
Good job Seb. Very well explained. Clear and synthetic!
@arachnid835 жыл бұрын
Thanks for explaining this. Your explanation was very deep and clear. I was a little perplexed with this concept.
@david-oj2je2 жыл бұрын
Thanks I absolutely love your videos
@raspreetsingh55424 жыл бұрын
An amazing explanation dude, I was having some difficulty understanding the callable type hints but you did such an amazing job of ELI5ing it. Thanks a lot :) and keep the great content coming
@nelsonmacy10104 жыл бұрын
Very clear and to the point. Appreciate
@xmandeng3 жыл бұрын
Really helpful overview. Thanks!
@pyadaaah98664 жыл бұрын
Nice video - thank you! Maybe you also could be interested in Pyadaaah, which provides runtime (!) type AND range checking?
@barulli874 жыл бұрын
everything is clearly explained! cheers!
@mivoe994 жыл бұрын
This is a great video on the topic
@debSha0074 жыл бұрын
Hi, For the first program I'm getting "Incompatible return value type (got "None", expected "int")" how to deal with it ?
@javierbosch13387 жыл бұрын
I'd love to get a list of your atom Python Packages that you are using. the REPL, autocomplete , etc. packages
7 жыл бұрын
If memory serves me, I was using magicpython, for correct syntax highlighting, and autocomplete-python for (obviously) autocompletion. The terminal that you see on the left isn't part of Atom though-it's a standalone Linux terminal!
@wolverinerazor6 жыл бұрын
which Linux distro do you use? btw, amazing videos. when will you become a trainer on pluralsight/ lynda etc?
@flyingsquirrel32716 жыл бұрын
Is None still always accepted by mypy? And if yes, why are they not using the "Optional" class from the typing module for that?
6 жыл бұрын
It seems they've changed this behavior (as default) as of MyPy 0.600, released last May. Now, None is no longer compatible with any type, but rather (as you say) you need explicitly allow None using the Optional type hint. An improvement in my opinion!
@thecodebear3 жыл бұрын
I really enjoyed it. Very usefull video . Thank you so much for this
@compucademy4 жыл бұрын
Nice. Clear and helpful.
@wentaoqiu40725 жыл бұрын
Your explanation is amazing, and your outfit is stunning..
@justchary5 жыл бұрын
Man, you good! Thanks for explanation.
@rafadydkiemmacha75434 жыл бұрын
PHP has real type hints. I was surprised to find out that Python’s interpreter ignores them.
@springinfialta1067 жыл бұрын
Static Typing rules!
@rafadydkiemmacha75434 жыл бұрын
It does, but Python doesn't handle that too well.
@sudharsan40405 жыл бұрын
Thanks for the informative video.
@RodrigoStuchi5 жыл бұрын
👏 👏 👏 👏, very nice explanations, thank you!!
@jeremyclark96974 жыл бұрын
Thank you!
@reydavid73005 жыл бұрын
Which code editor is that?
@RajveerSingh-yb6zq3 жыл бұрын
Except, Negative number have factorials :) And float have too... :)
@soldadopreciso5 жыл бұрын
interesting video, thanks pal, go ahead.
@lazypunk7945 жыл бұрын
Anyone else getting an error in factorial function while doing mypy type checking. It says return type got "None" expected "int", which actually makes sense because we are returning NOne for a certain case when we have mentioned that return type is int. Why is that error not popping up for you? Seems mypy got some smarter updates since
@lazypunk7945 жыл бұрын
And now passing "None" where "int" is expected gives error in mypy.
5 жыл бұрын
That's right. I believe that previous versions of MyPy (as I'm using in the video) always accepted None, whereas modern versions more sensibly don't. After all, int != None
@lazypunk7945 жыл бұрын
@ this actually causes another issue. Now in your type hints, you cant use "int" as your return type for the factorial function since we return "None" when number = 0. you are forced to use "Any" as return type.
@Serotonindude6 жыл бұрын
optional static typing... :D am i wrong, or is it like: 1) if static typing would have saved you... of course, you didn't use it 2) if i take my time to give proper type hints... why does the runtime not care at all? i may optionally type check it with another program... i don't know... feels like do it right all the time or just leave it
6 жыл бұрын
I agree that the current implementation of static typing is a bit half-baked. But I wouldn't be surprised if future versions of Python will allow you to enforce the type hints, and that could be very useful in some cases. (I have no inside information to support this, but just based on common sense I suspect that the Python devs will move in that direction.)
@ambig16 жыл бұрын
what webcam do u use? it is so good....
6 жыл бұрын
+Gajendra Ambi I'm using a Canon 750D, which is a decent photo camera.
@AliHasan-xh8in4 жыл бұрын
Thx for the tutorial
@oleholgerson34166 жыл бұрын
what about classes? how can you check for those?
6 жыл бұрын
That's actually really straightforward, because you can directly specify the name of any class in a type hint, as you can see below. It only becomes more complex if you want to specify details about the class, such as in the case of List[int], which specifies not only that you expect a list, but also that it should be a list of ints. class MyClass: pass def print_myclass(v: MyClass): print(type(v)) myobject = MyClass() print_myclass(myobject)
@ukaszx40725 жыл бұрын
Hi, Can someone explain me why there is a this -1 in line "return i*factorial(i-1)". I tried without that -1 run my code and it fails, but why? And which part of this code knows to divide some value like 3 into 1x2x3?
5 жыл бұрын
This is a classic computer-science exercise. You can find more details about it here: python.cogsci.nl/basic/functions/#exercises
@johnmarquess73756 жыл бұрын
Useful. Thanks.
@deadc0de5176 жыл бұрын
Isn't it proper to use Dict[Hashable,int] instead of Any as key?
6 жыл бұрын
That's an interesting question. Strictly, there's no difference, because the keys in a dict are by definition hashable. However, you could say that making this property of dicts explicit in a type hint makes code more readable. On the other hand, most people probably don't know what hashable means, so I would be inclined to say that it makes code less readable.
@ArjunPatel-gk9lq5 жыл бұрын
what compiler is this?
5 жыл бұрын
Since Python is an interpreted language, there's no compiler involved! (That term is generally reserved for programs that translated compiled languages like C to machine code.) But the editor that I'm using is Atom. And the static type checker is MyPy.
@ArjunPatel-gk9lq5 жыл бұрын
@ thank you! i have a lot to learn about python lol
@vineethgeorge73874 жыл бұрын
bro i need this intro song loved it verymuch
@rafadydkiemmacha75434 жыл бұрын
Coming from PHP, type hints in Python are actually really disappointing. The fact that they require external arbitrary tool to do anything is just weird. But the fact that None always passes makes type hints in Python virtually useless in my book.