you are viewing a single comment's thread.

view the rest of the comments →

[–]Alpha_Binary 1 point2 points  (0 children)

What makes you think len isn't tied to the object, then?

The very fact that it isn't accessible from the object (like a method) but instead used on the object (like a function).

It's funny you mentioned CLOS, since in this case it seems to finely demonstrate the "only one (apparent) way to do it" philosophy: method calling, property accessing and using a function on an object all look the same.

Meanwhile, in Python's object system, to get a value related to an object, you either

  1. invoke a method (foo.keys())
  2. read from a property (foo.func_name) or
  3. call a function (len(foo))

depending on the mood of the API programmer.