Paul Sokolovsky <>:

> Python already has that - like, len(x) calls x.__len__() if it's
> defined

In fact, what's the point of having the duality?

   len(x) <==> x.__len__()

   x < y <==> x.__lt__(y)

   str(x) <==> x.__str__()


I suppose the principal reason is that people don't like UFCS. Plus some
legacy from Python1 days.

Lisp & co. rigorously follow its UFCS. I think it works great, but that
is what people most ridicule Lisp for.

What do you think? Would you rather write/read:

   if size + len(data) >= limit:

or UFCS-ly:

   if size.__add__(data.__len__()).__le__(limit):


Reply via email to