2 ms·
> len is a holdover from earlier python No. len is basically a multimethod. > (you can define a method __len__ if you want…) You have to, it's part of the le
by masklinn 16y ago
> len is a holdover from earlier python
No. len is basically a multimethod.
> (you can define a method __len__ if you want…)
You have to, it's part of the length protocol, `len()` will not work if you don't. Because `len(o)` calls `o.__len__()`). If you start calling underscore-methods directly (outside of a super() access), you're heading for trouble with your coworkers.