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

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