A Simple & Effective Way To Improve Python Class Performance

Опубликовано: 06 Май 2022
на канале: ArjanCodes
107,391
5.9k

💡 Learn how to design great software in 7 steps: https://arjan.codes/designguide.

There's a very simple way to improve Python performance of your code. And you know what's so nice about this performance improvement? It also nudges you to use good Python software design practices - it's a win-win!

The code I worked on in this episode is available here: https://github.com/ArjanCodes/2022-slots.

🎓 ArjanCodes Courses: https://www.arjancodes.com/courses.

🎓 Sign up to Brilliant now and get 20% off the annual subscription: https://brilliant.sjv.io/arjancodes.

💬 Join my Discord server: https://discord.arjan.codes.

⌨️ Keyboard I’m using: https://amzn.to/49YM97v.

🔖 Chapters:
0:00 Intro
0:50 How classes work in Python
2:00 Descriptors
2:46 Basic class example with the dict dunder method
3:53 Using slots
5:02 Slots performance test
6:07 Using slots with dataclasses
7:19 Slots performance test #2 (with dataclasses)
8:00 Why are slots not used by default?
8:39 Slots limitation: mixins and multiple inheritance
10:23 Slots limitation: dynamic attributes
11:25 Final thoughts

#arjancodes #softwaredesign #python


На этой странице сайта вы можете посмотреть видео онлайн A Simple & Effective Way To Improve Python Class Performance длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь ArjanCodes 06 Май 2022, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 107,391 раз и оно понравилось 5.9 тысяч зрителям. Приятного просмотра!