Python __slots__ and object layout explained

Pubblicato il: 23 ottobre 2021
sul canale di: mCoding
99,416
4.8k

Save memory using Python slots.

Python _slots_ are useful for saving memory when you have a large number of small objects whose attributes are known ahead of time. In this video we learn about __slots__, what slots actually are and how they work.

― mCoding with James Murphy (https://mcoding.io)

Source code: https://github.com/mCodingLLC/VideosS...
Slots docs: https://docs.python.org/3/reference/d...
Descriptor docs: https://docs.python.org/3/reference/d...

SUPPORT ME ⭐
---------------------------------------------------
Patreon:   / mcoding  
Paypal: https://www.paypal.com/donate/?hosted...
Other donations: https://mcoding.io/donate

Top patrons and donors: Jameson, Laura M, Dragos C, Vahnekie, John Martin, Casey G, Pieter G, Krisztian M, Sigmanificient

BE ACTIVE IN MY COMMUNITY 😄
---------------------------------------------------
Discord:   / discord  
Github: https://github.com/mCodingLLC/
Reddit:   / mcoding  
Facebook:   / james.mcoding  

CHAPTERS
---------------------------------------------------
0:00 Intro
0:43 Normal class
1:53 Slots class
2:44 Why use slots
4:21 Slots are descriptors
5:45 What are slots
8:32 Inheritance
9:14 No metaclass slots
9:24 Using a dict slot


In questa pagina del sito puoi guardare il video online Python __slots__ and object layout explained della durata di ore minuti seconda in buona qualità , che l'utente ha caricato mCoding 23 ottobre 2021, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 99,416 volte e gli è piaciuto 4.8 mille spettatori. Buona visione!