On Sat, Mar 28, 2009 at 8:54 PM, kcrisman <[email protected]> wrote:
>
> Dear Support,
>
> I noticed the following behavior just now.
>
> sage: range(1,5)
> [1,2,3,4]
> sage: range(1,pi)
> Traceback:  etc etc etc
>
> The same thing happens with e.
>
> srange behaves fine but I didn't know if this was a problem.  Also, I
> now realize that the following is a little weird:
>
> sage: range(1,5)
> [1,2,3,4] # since 4<5
> sage: range(1,4.5)
> [1,2,3] # I would have thought [1,2,3,4] since 4<4.5
>
> This last raises a DeprecationWarning in my computer's native
> installation of Python, incidentally.
>
> Anyway, is any of this a problem - or should some of it be caught
> somewhere by Sage before the user sees it - or is it just normal
> behavior that is fine?

range is a builtin Python function, so there is nothing we can do
about all that except wait until Python changes (for the better, like
it is doing on your computer's native Python).

The point of srange is to provide a version of range that has much
better semantics for Sage.

Even better, of course, is [a..b] and (a...b).

William

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to