Re: [sage-devel] Re: Is there a math alternative to range and interval?

2018-10-18 Thread Kwankyu Lee
On Friday, October 19, 2018 at 10:16:28 AM UTC+9, William wrote: > > > > (4) is this "range" the vanilla python built-in? > > Yes. Type "range??" in Sage to see. > Right. I didn't know that range first converts the argument to int, which is why "range(Integer(10))" works. By the way, I am

Re: [sage-devel] Re: Is there a math alternative to range and interval?

2018-10-18 Thread William Stein
On Thu, Oct 18, 2018 at 5:58 PM Kwankyu Lee wrote: > (2) interval should be redefined to give a list of Integers. Do you agree? I wouldn't change it, because that code that depends on how it works will break. And having a 1-year deprecation policy for this would be very ugly. Also, it doesn't

[sage-devel] Re: Is there a math alternative to range and interval?

2018-10-18 Thread Kwankyu Lee
Thanks for your inputs. Let me summarize: ellipsis notation: gives a list of Integers sage: [0..9] [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] sage: preparse('[0..9]') '(ellipsis_range(Integer(0),Ellipsis,Integer(9)))' sage: type([0..9].pop()) ZZ.range: gives a list of integers sage: ZZ.range(10) [0, 1,

[sage-devel] Re: Is there a math alternative to range and interval?

2018-10-18 Thread Eric Gourgoulhon
Le jeudi 18 octobre 2018 14:13:33 UTC+2, Simon King a écrit : > > > Such as srange(i,j)? > > Btw, I've just noticed that in Python3-built Sage 8.4.rc1, srange returns a list. Shouldn't it return an iterator instead? Eric. -- You received this message because you are subscribed to the Google

[sage-devel] Re: Is there a math alternative to range and interval?

2018-10-18 Thread Eric Gourgoulhon
Hi, An alternative to Simon's answer is sage: [i.is_prime() for i in [1..9]] [False, True, True, False, True, False, True, False, False] Best wishes, Eric. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and

[sage-devel] Re: Is there a math alternative to range and interval?

2018-10-18 Thread Simon King
Hi Kwankyu, On 2018-10-18, Kwankyu Lee wrote: > I am teaching sage to a class of first year math students. Today I was > embarrassed when I tried > > [i.is_prime() for i in range(1,10)] > > because this raises an error. Until this point, I deliberately did not > mention that there are in fact