code review

Ben Finney ben+python at benfinney.id.au
Sat Jun 30 20:08:21 EDT 2012


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?

The operator symbols are not chosen arbitrarily for Python; they are, in
the case of ‘<’ and ‘>’, chosen because of semantic meaning those
symbols already have. That's the norm informing this meaning, and I
think it negates the point you're making.

> This is clearly not true. That's the inconsistency here with the rest
> of the language.

There is inconsistency already in the symbols people see and the
semantics already associated with those symbols. Expecting that any
symbol, before Python defines it, will be devoid of any normal meaning
is a delusion.

-- 
 \     “The Vatican is not a state.… a state must have territory. This |
  `\         is a palace with gardens, about as big as an average golf |
_o__)                         course.” —Geoffrey Robertson, 2010-09-18 |
Ben Finney



More information about the Python-list mailing list