Robert Bradshaw wrote: > On Sep 21, 2007, at 5:40 AM, Jaap Spies wrote: > >> William, >> >> I'm sorry to see that irange is not in sage-2.8.5. >> >> Your comment: >> >>> I think http://trac.sagemath.org/sage_trac/ticket/702 is actually >>> much nicer to use, so for now I think irange isn't needed. >> is not quite to the point. >> >> irange can take three arguments: start, stop and step. >> The arguments are not restricted to integers. > > So can the other range functions we have. > >> See the examples I give. Moreover I think irange is more Pythonic! > > I think the fact that irange looks so much like range is actually a > disadvantage because they act so different (I consider potentially > returning an extra item a significant difference, especially since > the presence of that extra item is sensitively dependent on (end- > start) % step.) I would be in favor of shortening srange(..., > include_endpoint=True) to srange(endpoint=True). > > In trying out your examples, I realized a shortcoming with the new > notation though. First, sometimes it's more convenient to give a step > rather than a second item. What would people think about the notation > > [start .. end ; step] > > Also, [10..1] now returns [10], it should probably return the empty > list. What about [10,11,.,0]? Also the empty list? I think so. Thoughts? > >> As irange is based only on srange it will be fast now tick #701 is >> closed. >> >> Arguments enough to reopen ticket #706, I think. > > I don't think so, especially after resolving the issues above, but > the two of us are probably equally bias about or own pieces of code. > The only other person to have spoken up is William, maybe we should > consider re-opening it if others speak up.
I'm in favor of the [1..2] notation if the ambiguities can be resolved nicely. I agree that irange is sort of redundant if we have srange. But I haven't used any of these very much... Does your patch take care of this? sage: [1.2..3.5] [1.20000000000000, 2.20000000000000, 3.20000000000000, 4.20000000000000] -Jason --~--~---------~--~----~------------~-------~--~----~ 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/ -~----------~----~----~----~------~----~------~--~---