On 05/10/2010 20:23, spir wrote:
On Tue, 05 Oct 2010 13:45:56 +0200
Boris Borcic<bbor...@gmail.com>  wrote:

Nick Coghlan wrote:
[...] Being able to say things like
"10:00"<= x<   '12:00", 10.0<= x<   12.0, "a"<= x<   "n" are much
clearer than trying to specify their closed range equivalents.

makes one wonder about syntax like :

for 10<= x<  20 :
      blah(x)


Mh, I suppose with rich comparisons special methods, it's possible to turn
chained comparisons into range factories without introducing new syntax.
Something more like


for x in (10<= step(1)<  20) :
      blah(x)

About notation, even if loved right-hand-half-open intervals, I would wonder 
about [a,b] noting it. I guess 99.9% of programmers and novices (even purely 
amateur) have learnt about intervals at school in math courses. Both notations 
I know of use [a,b] for closed intervals, while half-open ones are noted either 
[a,b[ or [a,b). Thus, for me, the present C/python/etc notation is at best 
misleading.
So, what about a hypothetical language using directly math *unambiguous* 
notation, thus also letting programmers chose their preferred semantics 
(without fooling others)? End of war?

Dijkstra came to his conclusion after seeing the results of students
using the programming language Mesa, which does support all 4 forms of
interval.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to