code review

rusi rustompmody at gmail.com
Sun Jul 1 00:07:50 EDT 2012


On Jul 1, 8:23 am, Steven D'Aprano <steve
+comp.lang.pyt... at pearwood.info> wrote:
> On Sun, 01 Jul 2012 10:37:05 +1000, Chris Angelico wrote:
> > On Sun, Jul 1, 2012 at 10:08 AM, Ben Finney <ben+pyt... at benfinney.id.au>
> > wrote:
> >> Thomas Jollans <t... at jollybox.de> 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.
>
> All the worse for those languages, since they violate the semantics of
> mathematical notation.
>
> The more I learn about C, the less I want to know about C. What sort of
> crazy language designer thought that having
>
> 2 == 2 == 2
>
> return 0 (false) was a good idea?

Kernighan and Ritchie admit they made a design mistake with their
operator precedences:

http://en.wikipedia.org/wiki/C_%28programming_language%29#Criticism

That those mistakes are repeated and replicated is more unfortunate.
The second bullet above to be read along with
http://en.wikipedia.org/wiki/Assignment_%28computer_science%29#Assignment_versus_equality



More information about the Python-list mailing list