Level 9 : What is the purpose of the __slots__ attribute in a Python class?

Author: IndraD | Tags: class | 1859+ Python FAQs | Share
string-iteration | lambda-function | advanced-file-operations | comparison | array | dataframe-and-series-objects | complex-number | benefit | data-type | binary | operator-overloading | dicts | list,-set,-and-dictionary-comprehensions | asyncio | deep-copy | namespace | logical-operator | list-method | classes | complex | encapsulation | polymorphism | conditional-statement | random-function | attribute | objects | context-manager | logical-operator | operations | file | file-handling | list-mutation | membership-operators-(in,-not-in) | list-vs-tuple | overflow | basic | command-line-parsing | name-mangling | opening-files-(open()) | module | compute | goto-function | counter-function | mathematical-function | for | range | encoding | generator | call | loop-control | logical-operators | factorial-function | managing-directories-with-os-and-shutil | python-syntax-and-structure | print | rollback | test-discovery | matrix | string-manipulation | postfix | fabs-function | reading:-read(),-readline(),-readlines() | syntax | functional-programming | sum-function | access-modifier | datatype | formatting-with-strftime | slicing | string-slicing | file_handling | else | set | string-formatting | syntaxerror | recursion | sorted | slice | statement | string-formatting | syntax-error | stack | shallow-copy | set-operation | static-method | decimal | lists | init | floats | application | exponentiation | operator-or | round | sys | string-method | interpreter | bitwise | built-in-function | id-function | lambda-functions | while-loop | datetime | iterable | default-arguments | operator | indexing:-loc-vs-iloc | multiprocessing | error-handling | boolean-masking | map-function | swapping | join | input | multiple-inheritance | data-structure | strings | thread-synchronization | reading-and-writing-files | choice | pandas | min-max-function | yield | docstring | list-slicing | python-repl | __all__-attribute | control-flow | indexing | decorator | __future__ | global-variable | min-function | iterator | sys-module | control-flow | working-with-dates-and-times | python-django | generators-in-python | data-structures | library | methods | data-type-conversions | datetime.date,-datetime.time,-datetime.datetime | intering | design-principle | identifier | pep | destructor | using-lists-as-stacks | global | control-statement | exception | data-structure | filter | tuple-unpacking | zip | comprehension | functional-programming | list-methods-and-slicing | def | exception-handling | nested-loop | while-loops | list | formal-and-actual-parameter | string-methods | raise | counter | random | syntax-error | matplotlib | conditional-statement | print-statement | heap-memory | dictionary-comprehensions | operator-and | integer | list-indexing | input-function | loop | expand-tab | difference-between-threads-and-processes | anchors-(^,-$) | recurssion | loop-control-statements | using-assertions-(assertequal,-assertraises) | match | data-types | pickling--unpickling | binary-operation | built-in | immutable-data-type | immutability | string-method | thread | defining-functions | class-and-object | append | condition | regex | aggregating-data-with-functools.reduce() | boolean-and-non-boolean | expression | int | using-map()-for-transformations | frozenset | input-function | sum() | sets | package-management | tuple | list-join | walking-through-directories-using-os.walk() | magic-method | single-inheritance | parameter | working-with-temporary-files-using-tempfile | constructor | precedence | dictionary-methods | conditional-statements | debugging | multiple-except-blocks | using-join()-and-is_alive()-methods | assignment-operators | regular-expression | error-handling | format | inherit | numpy | virtual-environment | method-overloading | data-structures-in-python | scientific-notation | literal-characters-and-special-characters | staticmethod | creating-and-starting-threads | string | dictionaries | implementation | using-os-and-pathlib-modules | round-function | function | global-keyword | data_structure | python | class-and-instance-variable | feature | function-argument | software-design | time-series-with-pandas | python-history | else-statement | string-concatenation | copy | filter-function | operand | global-variable | introduction-to-threads | directory-operations | with-statement | memory | asyncio-module | floating-point-precision | import-method | matrix-list-comprehension | split | mysql | sorting | reading-and-writing-large-files-efficiently | generators | string-slicing | regular-expressions | dictionary | lambda | overriding-methods | namedtuple | threading | type-conversion-and-casting | exception-handling | list-comprehensions | escape-operator | python_version | invalid-list | identity-operators-(is,-is-not) | sorting-and-ranking | thread-safe-data-structures-(queue.queue) | touples | multiple-inheritance | tuple-methods | assignment-operator | conversion | using-the-threading-module | mathematics | quantifiers-(*,-+,-?,-{}) | built-in-modules | while-and-for-loop | precedence-and-associativity | version-check | inheritance | list-comprehension | default-mutable-argument | enumerate() | mutable | list-operation | descriptors | working-with-file-paths | unit-testing | math-copysign | data-type | arbitrary-arguments-(*args,-**kwargs) | introduction-to-multiprocessing | function-and-scope | writing:-write(),-writelines() | filtering-and-indexing | bitwise-operator | joining-and-merging-dataframes | creating-custom-modules | center | python-module | key-value-pairs | assert | raise-statement | variable | collection | version | bitwise-operator | class | operators | virtual-environment | turtle | pass | lambdas | iterators | head-and-tail | parsing-with-strptime | list-comprehension | multithreading | functions | arithmetic-expression | error | zfill-function | memory-management | using-else-and-finally | logical-operation | introduction-to-python | tuples | mapping-function | max-min | async | type-conversion | oops | comment | zip-function | math | working-with-binary-files-(rb,-wb) | __init_subclass__ | class-decorators | gil | handling-missing-values-(fillna,-dropna) | method | using-yield-in-functions | object-attribute | file-handling | pseudocode | booleans | why-use-multiprocessing-over-threading?-(gil) | arithmetic-operation | type-conversion | boolean | update | numeric | oop | higher-order-function | identity-operator | built-in-function | installation | class-and-inheritance | identity-operator | odd-number | type_conversion | collections | indentation | typeerror | integers | python-operators | keyword | return-statement | while-else-loop | loops ...