Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!indigo.octanews.net!news-out.octanews.net!mauve.octanews.net!news.astraweb.com!border6.newsrouter.astraweb.com!not-for-mail From: Ben Finney Newsgroups: comp.lang.python Subject: Re: code review References: <6c39594f-79cb-4d4f-967e-bbc3f68cdbdf@f8g2000pbf.googlegroups.com> <4fed59b7$0$29978$c3e8da3$5496439d@news.astraweb.com> <2662370.TGmo96CKe1@PointedEars.de> <87wr2oecf6.fsf@dpt-info.u-strasbg.fr> <4FEF7117.7000109@jollybox.de> <87bok0qr62.fsf@benfinney.id.au> X-Public-Key-ID: 0xAC128405 X-Public-Key-Fingerprint: 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405 X-Public-Key-URL: http://www.benfinney.id.au/contact/bfinney-pubkey.asc X-Post-From: Ben Finney Date: Sun, 01 Jul 2012 17:28:20 +1000 Message-ID: <87395cq6sr.fsf@benfinney.id.au> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) Cancel-Lock: sha1:EEOdf3ERUROwRZ3j0qLmJSPZwas= MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Lines: 40 Organization: Unlimited download news at news.astraweb.com NNTP-Posting-Host: 79c255be.news.astraweb.com X-Trace: DXC=[C\MH8o^6dG0UO2<>T]L;AL?0kYOcDh@JW\:Hm@YlDbJ83@2Tm:hbhCKX9\E Xref: csiph.com comp.lang.python:24732 Chris Angelico writes: > On Sun, Jul 1, 2012 at 10:08 AM, Ben Finney wrote: > > Thomas Jollans writes: > > > >> My sole point, really, is that "normally", one would expect these two > >> expressions to be equivalent: > >> > >> a < b < c > >> (a < b) < c > > > > What norm gives you that expectation? That's not how those operators > > work in mathematical notation. I know of no programming language > > that would give a newcomer to Python that expectation. So where is > > the norm you're referring to? > > C, SQL, REXX, and many other languages. So, languages without strong typing then. In that case, I revise my statement: I know of no programming language with strong typing that would give a newcomer to Python the above expectation. Since Python does have strong typing, norms about operations from weakly-typed languages should not be expected to apply. (Incidentally, PostgreSQL was the SQL implementation I went to, and:: postgres=# SELECT (1 < 2) < 3; ERROR: operator does not exist: boolean < integer LINE 1: SELECT (1 < 2) < 3; ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. So not all SQL implementations make the mistake of weak typing.) -- \ “Try adding “as long as you don't breach the terms of service – | `\ according to our sole judgement” to the end of any cloud | _o__) computing pitch.” —Simon Phipps, 2010-12-11 | Ben Finney