Robert Bradshaw wrote: > On Sep 21, 2007, at 5:40 AM, Jaap Spies wrote: >
>> 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. > Sure, that is why they exists. But there are strange side effects in [a..b]. My last example has an educational impact: See the calculus thread. >> 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). > Looking like range: xrange, srange, xsrange, sxrange, Ellipsis. In a few years with Python 3k xrange and family will be obsolete. I still find having a function irange is more Pythonic. Maybe you should formulate a PEP for inclusion of the '..' operator for inclusion in Python 3.x! > 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] > This is the equivalent of irange(start, end, stop), I soppose? > 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? > [10,11,.,0] ?? >> 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. Yes, but I think there arguments enough to add a function irange or equivalent with a better name! Indeed, I'm not a fan of the a..b notation. It reminds me to much to Maple, where there is no alternative step argument. > The only other person to have spoken up is William, maybe we should > consider re-opening it if others speak up. > Jaap --~--~---------~--~----~------------~-------~--~----~ 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/ -~----------~----~----~----~------~----~------~--~---