Sep-24-2020, 10:57 AM
I need to know whats the difference in:
something()and
something[]
Difference () and []
|
Sep-24-2020, 10:57 AM
I need to know whats the difference in:
something()and something[]
Sep-24-2020, 11:05 AM
something() applies to objects having a __call__() method and it executes this method, while something[] applies to objects having a __getitem__() method and it executes this method.
Sep-24-2020, 11:33 AM
Examples of the two cases mentioned by Gribouillis are functions in the former case and lists/dictionaries/tuples in the latter.
Sep-24-2020, 11:51 AM
Also consider braces {}. A good source to see what you use when is the docs at Python Docs
|
|