+ 1

What is the difference between __getitem__ and __call__

__getitem__ vs __call__

29th Dec 2020, 7:10 PM
Ziead Shab Kalieh
Ziead Shab Kalieh - avatar
4 ответов
+ 2
_getitem_ is a method that is used to access list items or arrays. _call_ is also a method where you are able to write classes in which instances are functions(They behave like a function in other words).
30th Dec 2020, 10:57 AM
Bliss
Bliss - avatar
+ 3
Thanks💓Bliss
30th Dec 2020, 3:39 PM
Ziead Shab Kalieh
Ziead Shab Kalieh - avatar
+ 2
Yep sure here you have more detailed definition for call method and also you have examples so you can see how to use it https://www.geeksforgeeks.org/__call__-in-JUMP_LINK__&&__python__&&__JUMP_LINK/ And here you have _getitem_ examples and more detailed definition https://www.geeksforgeeks.org/__getitem__-and-__setitem__-in-python/
30th Dec 2020, 2:31 PM
Bliss
Bliss - avatar
+ 1
Thank you sir but I didn't got it can you explain more Bliss
30th Dec 2020, 2:15 PM
Ziead Shab Kalieh
Ziead Shab Kalieh - avatar