In Python, is the following the only way to get the number of elements?
arr.__len__()
If so, why the strange syntax?
The preferred way to get the length of any python object is to pass it as an argument to the len function. Internally, python will then try to call the special __len__ method of the object that was passed.
len
__len__