3 ms·
^ this ^ never understood why certain methods (or are they functions?) are not called on the objects. This is one of the reasons I love Ruby, everything is clea
by griffindy 14y ago
^ this ^
never understood why certain methods (or are they functions?) are not called on the objects. This is one of the reasons I love Ruby, everything is clearly an object.
- masklinn 14y ago> ^ this ^ never understood why certain methods (or are they functions?) are not called on the objects. Because they don't depend on a given class, they're protocols. There's no "master class" in which to put them, so they go in some sort of bastardized CLOS-like generic method instead.
- Flow 14y agoThere's no need for a super class to have a len() method. I don't get your reasoning here, Python is not a statically typed language.
- orangecat 14y agoWith duck typing, that shouldn't matter. Lots of methods in the Python standard library take "file-like objects" that have read() methods and no common superclass, and that works fine without read being a top-level function.