|
|
|
|
|
by Calavar
1266 days ago
|
|
> There’s no need for adding say, len, to every object that needs a len function. I’d argue that is consistent. Python's len works by calling the __len__ method, which must be added to every class that needs a len function. Since you're already defining a method with a standard name on every class that needs it, Ruby just has you call that method directly as opposed to the absurdity of intentionally obfuscating the method name with underscores so that people use a global helper function instead. Even C++, with all its warts and its 1980s design got this right in the std lib with the size method. Honestly, I find some of these defenses of Python quite humorous. |
|