Does Python have a Type System?
23:59
Пікірлер
@statuschannel8572
@statuschannel8572 3 күн бұрын
please do more SQLAlchemy 2.0 videos with postgres if possible. thanks
@tga094
@tga094 7 күн бұрын
Thanks a lot, I've been scratching my head over this for hours,
@voa23
@voa23 11 күн бұрын
Have been looking for a video with this kind of explanation, thank you so much. Superb Video!😊
@python-for-everyone
@python-for-everyone 9 күн бұрын
Thank you!
@SekaiKyo-hq3vu
@SekaiKyo-hq3vu 13 күн бұрын
It's said too well, I have been troubled by the concept of closure for a long time, and I have watched many videos without a solution. When I tried to learn JavaScript, I found that I couldn't get around it. When I came back to watch this video again, I suddenly understood it. It turns out that it is so similar to the class usage in Python. Thank you,😀
@python-for-everyone
@python-for-everyone 12 күн бұрын
Glad it was helpful!
@matiaspalacios83
@matiaspalacios83 15 күн бұрын
thanks
@BigDBrian
@BigDBrian 16 күн бұрын
I believe list comprehension is also just a generator. You can use it to create non-lists too, such as sets or tuples. numbers = [1, 2, 3, 4] doubled = tuple(2*x for x in numbers) # tuple of (2, 4, 6, 8)
@python-for-everyone
@python-for-everyone 16 күн бұрын
doubled is a generator expression here (round brackets)
@BigDBrian
@BigDBrian 16 күн бұрын
@@python-for-everyone you're right -- edited to actually make it form a tuple
@roisiboni2259
@roisiboni2259 17 күн бұрын
wow, you explained it really clearly! I knew about this feature and how to use it, but didn't fully understand it's true use. thank you very much, keep it up!
@python-for-everyone
@python-for-everyone 16 күн бұрын
Thank you for the kind words!
@aniruddhachakrabortyindia
@aniruddhachakrabortyindia 18 күн бұрын
Wow! This is something I've never knew. Thanks! I'm not sure where to use it tho
@python-for-everyone
@python-for-everyone 18 күн бұрын
I know what you mean. But at one point, you will think: YIELD! :-)
@Ventrix_8
@Ventrix_8 19 күн бұрын
thank you very much for this clear explaination video on closures..
@jubayeralam8358
@jubayeralam8358 19 күн бұрын
where is your constructor
@ChandraP12330
@ChandraP12330 23 күн бұрын
Love these videos! Keep posting, thanks 😊
@akashgeorge5433
@akashgeorge5433 25 күн бұрын
cant we just write a serializer function (not a method in a class) and use it? why do we need to make it to a class in the first place?
@python-for-everyone
@python-for-everyone 21 күн бұрын
Yes, you can do that. A class would be nice to keep different serialize and deserialize methods together.
@MatisCCCC
@MatisCCCC Ай бұрын
ashamed to say but even though I've been working for 2 years I had to search how to flatten a list using list comprehension, you explain it so well and simple, thank you and good job!
@python-for-everyone
@python-for-everyone 28 күн бұрын
Thank you. And let me make you feel better: I always forget how to flatten a list with list comprehension and have to come back to this video :-)
@mattstirling6317
@mattstirling6317 Ай бұрын
Helped me a lot, thanks!
@cant_show_user
@cant_show_user Ай бұрын
Man, you are amazing! When you started with a brief history... it`s just fantastic...
@python-for-everyone
@python-for-everyone Ай бұрын
Thank you for that great compliment!
@indiajackson5959
@indiajackson5959 Ай бұрын
Excellent video
@mahboobulhassan7419
@mahboobulhassan7419 Ай бұрын
excelent work
@aguy98ptk
@aguy98ptk Ай бұрын
awesome example
@wimvangeyt3866
@wimvangeyt3866 Ай бұрын
Does this also work in a Flask webapp?
@jankowalski-oe4qb
@jankowalski-oe4qb 29 күн бұрын
sure
@rajdeepjadav6263
@rajdeepjadav6263 Ай бұрын
Allways use dark mode and big fonts.
@monkeyDnawin
@monkeyDnawin Ай бұрын
thank you bro ❤❤❤
@python-for-everyone
@python-for-everyone Ай бұрын
You're welcome! :-)
@viettruong4742
@viettruong4742 Ай бұрын
how to Downsides of an ORM, i waiting for this
@iananeri6255
@iananeri6255 Ай бұрын
I really like the way you teach. Great explanation, I'm binge watching your videos. Greetings from Brazil
@python-for-everyone
@python-for-everyone Ай бұрын
Thank you so much for that nice compliment! Greetings back from Berlin
@iananeri6255
@iananeri6255 2 ай бұрын
I'm watching all your videos, wish I had known this channel before
@iananeri6255
@iananeri6255 2 ай бұрын
This channel deserves more views. Great job
@iananeri6255
@iananeri6255 2 ай бұрын
I understood everything so quickly, thank you
@shashirajusiddaraju4979
@shashirajusiddaraju4979 2 ай бұрын
Wow. such simple explanation, Great!, thanks
@devin865
@devin865 2 ай бұрын
I like you vids, groupby is a handy one to know! For the second half with the dictionary, if it were me I would write it using setdefault. So, for name, department in employees: grouped_by_department.setdefault(department, []).append(name)
@thisoldproperty
@thisoldproperty 2 ай бұрын
A superb explanation. Thanks for taking the time to explain!
@thisoldproperty
@thisoldproperty 2 ай бұрын
Very clear explanation. Great use of dir and inspect commands.
@sathyanarayanan4839
@sathyanarayanan4839 2 ай бұрын
OMG THANK YOU FINALLY IT MAKES SENSE IT ALL MAKES SENSE
@thisoldproperty
@thisoldproperty 2 ай бұрын
Knowing much about Methods vs Functions, you still managed to blow my mind with your information here. Thanks.
@thisoldproperty
@thisoldproperty 2 ай бұрын
Given you went to the effort to mention python decimal data type, here are the results using that data type: # python 3.11.0 from decimal import Decimal result: Decimal = Decimal(Decimal(0.1) + Decimal(0.2)) print(f'{result}') # 0.3000000000000000166533453694 print(f"{result.quantize(Decimal('0.1'))}") # 0.3 print(f"{result:.1f}") # 0.3
@thisoldproperty
@thisoldproperty 2 ай бұрын
Loved the pic of the 5 1⁄4 floppy disk! Flash back, indeed.
@thisoldproperty
@thisoldproperty 2 ай бұрын
The side by side comparison of the closure compared to a class was the epiphany I needed. I appreciate the time you spent making this (and the other) videos! I like how you get to the point and use really simple code to demonstrate the concepts. You should team up with ArjanCodes sometime to create a co-shared video.
@python-for-everyone
@python-for-everyone 2 ай бұрын
Thank you so much for the compliment. What a nice idea to team up with @ArjanCodes. I have much respect for him and his channel.
@KingBeyu
@KingBeyu 2 ай бұрын
Hi Instructor, We discovered your Udemy course and we’re impressed by its high quality. we noticed that the course’s current enrollment numbers and reviews don't fully reflect its potential impact. We’d love to discuss how we can help increase its visibility and engagement. Are you open to a chat?
@thisoldproperty
@thisoldproperty 2 ай бұрын
This was an awesome, simple presentation. I've found your videos very helpful. (even as an advanced coder)
@python-for-everyone
@python-for-everyone 2 ай бұрын
What a nice compliment. Thanks!
@mahboobulhassan7419
@mahboobulhassan7419 2 ай бұрын
Excellent, simple,clear,to the point explanation
@tortos813
@tortos813 2 ай бұрын
"if you're watching this video you probably did something like.." idk man i just got a ytb recommendation but nice video tho 👍
@rockerthatrocksify
@rockerthatrocksify 2 ай бұрын
same
@python-for-everyone
@python-for-everyone 2 ай бұрын
Well, then the algorithm is with us :-) Thank you for the compliment!
@tortos813
@tortos813 2 ай бұрын
@@python-for-everyone i just noticed but are you a github purple user on vscode ?
@akashgeorge5433
@akashgeorge5433 2 ай бұрын
thanks man wonderfully explained
@jorgesanabria6484
@jorgesanabria6484 2 ай бұрын
Oh wow! thank you so much. Your videos are so clear on python basics and OOP. I am going through all your videos now. Self kept tripping me up unfortunately... until now! I never got a clear answer as to why we have two parameters in the method.
@python-for-everyone
@python-for-everyone 2 ай бұрын
What a great compliment! Have fun!
@fswerneck
@fswerneck 2 ай бұрын
7:05 I can bring something of value to this! (not sure if you have covered this in other videos, yt literally just recommended this one video to me.) But you can define and require a function that will do the conversion for you. Your converter object could be constructed with a dependency for a function that takes in a string and spits out the type. @dataclass # for the sake of simplicity in comments class Converter[T]: convert: Callable[[str], T] def convert(self, data: str) -> T: return self.convert(data) This way you don't have to worry about getting the type from dunder fields, or worry that they will work with exactly one string argument. my_int = Converter(int).convert("3") `int` can be used as such because it's a perfectly valid callable that takes in a string and returns an integer. Also, because type checkers are intelligent, you don't have to specify the type for Converter; it will infer from `int` that T is int. Example with datetime: my_dt = Converter(datetime.fromisoformat).convert("2024-11-06T15:54:00") This works because fromisoformat is a class method (a callable) that takes in a string, and spits out a datetime. And type checkers look at the return type of fromisoformat to infer that this is a Converter[datetime]. All this said, let's simplify all this. We don't need a class. A simple function is perfectly valid. One can define a type alias as such: type ConverterFunc[T] = Callable[[str], T] and then, you can require a ConverterFunc anywhere else in your code, and any function that fits the signature will pass type checking. def read_date_from_user(convert: ConverterFunc[datetime]): from_user = input() # sanitize, if necessary return convert(from_user)
@Ness-d2c
@Ness-d2c 2 ай бұрын
lets say we have a class called salary. This class has a method increase_salary which increases salary 1%. So are we going to use self here and if yes how do we reference the first name and last name and the salary parameter?
@Ness-d2c
@Ness-d2c 2 ай бұрын
Can you please show using self across other methods within or outside the classes?
@python-for-everyone
@python-for-everyone 2 ай бұрын
In this example, I create a class with initializer and raise_salary method where self is "shared" within the class. kzbin.info/www/bejne/lXzZgJawZryIns0
@Raisincookies55
@Raisincookies55 2 ай бұрын
short and to the point. great work
@kimurayuka7590
@kimurayuka7590 2 ай бұрын
Thank you for this :)
@jeevas2joy
@jeevas2joy 2 ай бұрын
I appreciate your work and I trust in this.
@Dhar01
@Dhar01 2 ай бұрын
God, on "get the terminology right" section, I just felt that I wanted this! This is the type of video I want to suggest everyone! I request you to make more video like this! This got me subscribed to your channel.
@python-for-everyone
@python-for-everyone 2 ай бұрын
Thank you very much! And if you have a special request for a video, let me know.
@mahboobulhassan7419
@mahboobulhassan7419 2 ай бұрын
excelent
@mahboobulhassan7419
@mahboobulhassan7419 2 ай бұрын
excelent