Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Marko Rauhamaa Newsgroups: comp.lang.python Subject: Re: Uniform Function Call Syntax (UFCS) Date: Sun, 08 Jun 2014 18:56:47 +0300 Organization: A noiseless patient Spider Lines: 31 Message-ID: <8738ff2y4g.fsf@elektro.pacujo.net> References: <8b96ae27-20fa-4df9-807e-c806fed983c0@googlegroups.com> <38058e64-0113-457c-ae63-cc66e8b569cd@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx05.eternal-september.org; posting-host="ff5cf27ef3d5b31f034d3b72bdc27a41"; logging-data="10937"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Pzi47Tjats4JkTwM+TvLh" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) Cancel-Lock: sha1:pRdv5BqqiIgaEJMaH3ARc0LqihY= sha1:FH0Vfa+rUW0lKK4vxzpUqO9nz48= Xref: csiph.com comp.lang.python:72967 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__() 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