Magic Methods - Making Python builtins work with your classes

preview_player
Показать описание
Make builtins like max work with your classes.

SUPPORT ME ⭐
---------------------------------------------------

BE ACTIVE IN MY COMMUNITY 😄
---------------------------------------------------
Рекомендации по теме
Комментарии
Автор

I am a self-taught junior developer who has gotten very sick of the LEARN PYTHON IN 5 SECONDS videos. I'm well past the 'get familiar' phase and well into the 'figure out how to actually build something for my boss' phase. Having someone like you to concisely and clearly articulate some genuinely useful material is extremely valuable. I certainly don't have the time or money for one of your classes at the moment, but based on the clarity of your videos I'd encourage anyone reading to take a class if you're new. Thank you!

psauchelli
Автор

I like this guy. He gets straight to the point and doesn't use click-baity thumbnails or titles.

Arkssa
Автор

Hey, I just found your channel and I like the topics that you are covering. I’ve seen a few now where there is interesting code on the screen and you verbally reference a previous video that may have more detail. It would be great if you included links to your other videos that you mention!
Keep up the good work!

danielnadeau
Автор

this channel is awesome. Seriously keep it up its great and super useful for my daily programming.

dhineshraj
Автор

I will take a day off, will close myself in my home office and will just binge watch all of you videos

adamstrejcovsky
Автор

so much easier than in c++ defining how unary and binary operators work love the videos

stsam
Автор

Unfortunately this often doesn't work for sum(). Since sum always starts counting from 0 (an int), then adds whatever the first element you're summing is, you'll get: TypeError: unsupported operand type for +: `int` and <whatever type you're trying to sum>. You therefore have to supply an initial value to sum() as a default argument which replaces the int 0 with an appropriate "0" in this new context.

LittlePharma
Автор

I do have a question about the (to me) slightly unpythonic way dunder-repr and similar functions can't be redefined. I've recently had a case where it would be much more efficient for the object to choose from two different reprs at init time, but ultimately i had to instead make dunder-repr call bare-repr and redefine that one. is there any way around this kind of thing, or are the dunders unable to be redefined like this?

MrRyanroberson
Автор

Your videos are just so useful and great ;)

DassaultSysteme
Автор

You look like melancholic jerma! :D I love your videos

mfrederikson
Автор

Overloading behaviour of existing operators is one thing, how about defining entirely new operators?

lawrencedoliveiro
Автор

I liked the video and giving a comment, but complete overview of all dunder methods will be liked more

bvg
Автор

Make a video about __init__ and __new__ magic methods

midhunrajaramanatha
Автор

What are the functions of the __ge__ and __le__ methods?

nicke
Автор

Don't tell me it's called dir because it's analogous to DOS dir. That's silly and you shouldn't encourage people to think of your object model as a directory tree imo

jwrush
Автор

Something is wrong with the audio, but definitely not with the content.

jonisas
Автор

Cool video, but I've wanted to point out that this is not the correct way to hint a type, it's List[int], not list[int], from typing import List

alexg
Автор

use light theme it will be more easier to read code for us

meetkoriya