For what it's worth, I too am against using either form of "open-ended interval" notation such as [a,b), [a,b[ and so on. Let's keep brackets matching; both those notations are used in Mathematics (the latter mainly in the French world), but *only* for intervals of reals where it is necessary. I cannot see why anyone would want to write (0..10) to mean the same as [1..9], i.e. [1,2,3,4,5,6,7,8,9].
But the use of .. for *inclusive* ranges does seem very natural to me, despite not being in Pyuthon proper, and I would agree with Peter Doyle's remarks on that for undergraduate teaching. [Aside: Peter, does Dartmouth still teach BASIC to all undergratuates (in all majors) like they did when I was there 1982-84? That was when Kemeny was still revered by all, and part of te requirement was that every single undergrad had to watch the 2-part video of Kemeny explaining BASIC programming.] John On 9/20/07, William Stein <[EMAIL PROTECTED]> wrote: > > ---------- Forwarded message ---------- > From: Peter Doyle <[EMAIL PROTECTED]> > Date: Sep 20, 2007 9:04 AM > Subject: Re: [sage-devel] Regarding range and '..' operator > To: William Stein <[EMAIL PROTECTED]> > > > Hi William, > > I am glad you have not abandoned your suggestion of introducing the > 1..10 notation, which I think is absolutely brilliant. I am new to > Python, and while I am not 100% keen on it, I do appreciate the clean, > simple syntax. From long experience using computers in undergrad > courses, I understand that there are great benefits to being able to > tell at a glance what a (simple) program is supposed to do. Unless > programming is the subject of the course, there is no time to spare > for semicolons and underscores. if I want students to be able to > modify existing programs, and write simple programs of their own, the > language has to be simple, in a way that Python mostly is. If I'm > going to use SAGE in a probability course, it will be a huge advantage > to have this simple, crystal clear syntax for loops, conditionals, > function definitions. Students are going to know at a glance how > simple demo programs work. Except for the problem with range(). But > if I can write > > for i in 1..10 > > instead of > > for i in xrange(1,11) > > then we'll be golden. Well, until we crash into other peculiarities > of Python, like the way I can accidentally redefine the default value > of a list argument, or otherwise accidentally modifiy an argument > passed by reference. But that's way down the road, and we'll likely > not run into that in a probability course or a calculus course. > > Cheers, > > Peter > > Cheers, > > Peter > > > -- > William Stein > Associate Professor of Mathematics > University of Washington > http://wstein.org > > > > -- John Cremona --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~----------~----~----~----~------~----~------~--~---