Level 10 : What is the purpose of the __call__ method in a Python class?

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