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

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