Paul Sokolovsky <pmis...@gmail.com>:

> 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__()

etc.

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):


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to