John,
> sage: [q for q in range(100) if q.is_square()]
>
> --rather, one has to do this
>
> sage: [q for q in range(100) if Integer(q).is_square()]
> [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
>
> or even this:
> sage: [Integer(q) for q in range(100) if Integer(q).is_square()]
> [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
>
> if the elements of this list need further Integer methods to be called on
> them.
>
> I did eventually find the srange() function, but find its name rather
> un-guessable. Why s? Why not Irange, say?
I also "enjoyed" several times converting from 'int' to 'Integer' and back.
For beginners, this is a real difficulty, and in my opinion range? or xrange?
should give a big warning that the "list of integers" output contains Python
integers, which cannot be mixed with SAGE integers 'Integer'.
It would also be nice to have a pointer from range? to srange (which does
mention the difference between SAGE integers and Python int's).
Finally, is there a valid reason why we have both 'int' and 'Integer'?
(The 'int' type does not seem to have any size limitation.)
Paul
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---