Magic Methods & Dunder - Advanced Python Tutorial #1

preview_player
Показать описание
We are starting out with a new tutorial series on advanced Python programming. In this first video we talk about magic methods or dunder.

◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾
📚 Programming Books & Merch 📚

💻 Exclusive Content 💻

🌐 Social Media & Contact 🌐

Рекомендации по теме
Комментарии
Автор

finally an "advance" series that actually thought me something new!

turgutbababalm
Автор

This IDE color scheme is the equivalent of having a drip in fashion world.

MuffineousMuffin
Автор

Suggestion for this series: I'd love to see you cover unpacking in Python. There's a lot more to it than people realize at first, especially the use of _ and *, so you could make a small video on that.

Love your content, btw :)

mrmoinn
Автор

LETS GOOO, A PYTHON ADVANCED SERIES. Thanks a lot :)

ayaanp
Автор

There's two mistakes worth mentioning here. When discussing __len__() you suggested that the correct way to do it for your Vector example would be Math.sqrt() to get the magnitude of the vector. __len__ is not just any arbitrary "length" it's supposed to be used to identify the items in a collection. It needs to return an int, not a float and you shouldn't be implementing dunder methods for some alternative use, it needs to keep the intended meaning. The other mistake was in __repr__(). There's __repr__ and __str__ and the reason why there's two of them for a very similar thing is because __repr__ isn't just some arbitrary string, it's supposed to be valid Python. As an example, the following should be true for a class where the __repr__ and __eq__ methods are properly implemented: "obj == eval(repr(obj))"

It's more or less serializing the object. You could have __str__ implemented exactly as you demonstrated, if __str__ is missing then converting to a string will fall back to using __repr__.

AndrewMerts
Автор

Very nice, You posted this while I was on my lunch break, perfect

robinferizi
Автор

WOW! You are so clean!
Please keep up with this amazing series!

giacomocesareo
Автор

started from the beginner series to here thank you for making these videos!

collinchau
Автор

This is what I needed, Thank you so much for this tutorial series!

daguttt
Автор

That's what I've been waiting for, let's go !

anthony_issa
Автор

That is really cool! Great video thank you! Can't wait to try these in my coding. Looking forward to watching the rest of the video series

asdf
Автор

this is gold! thank you fro the content, extremely helpful and great presentation skills

paduraruovidiu
Автор

You made my day! That was the best simplest way to train these Dunders

shb
Автор

Text editor colors changed! That's an advanced level!

borislabut
Автор

Very thanks for all your efforts and informative courses. I am learning a lot from your great contents.

mehdimojaradi
Автор

So __call__ only works in the bash console? I couldn't get it to show anything in IDLE

ViralKiller
Автор

__repr__ method is for programmers, so should be return "Vector(60, 80)".

pawegorka
Автор

Thanks for making the video on this topic

lucario
Автор

Really looking forward to this series see you in the next vid 🧐

Ken-Czyz
Автор

Excellent!! I'm looking forward seeing all these :)

jonastjepkema
visit shbcf.ru