#4893: srange docstring is misleading
---------------------+------------------------------------------------------
 Reporter:  cremona  |       Owner:  cwitty  
     Type:  defect   |      Status:  new     
 Priority:  minor    |   Milestone:  sage-3.4
Component:  misc     |    Keywords:  range   
---------------------+------------------------------------------------------
 I reported
 {{{
 The docstring for srange() says:

    Return list of numbers \code{a, a+step, ..., a+k*step},
    where \code{a+k*step < b} and \code{a+(k+1)*step > b}.

    This is the best way to get an iterator over Sage integers as
    opposed to Python int's.  It also allows you to specify step sizes
    to iterate.  It is potentially much slower than the Python range
    statement, depending on your application.

 The second paragraph suggests that what you get is an iterator, but in
 fact you get a list.  Is there any good reason why srange does not
 return an iterator?  Surely that would be more efficient in most
 cases, and the user can turn the iterator into a list if needed.
 }}}
 and William replied
 {{{
 srange's docstring is wrong and should be fixed.  Please post a patch.

 The function sxrange gives a proper python iterator.  The
 documentation for srange should contain a remark that sxrange gives
 the iterator version, and if it doesn't add that too :-)

 But don't change srange to be a python iterator -- that would be like
 making range a python iterator, which is a bad idea since sometimes
 people use ranges not as iterators.
 }}}
 so I will post a suitable patch,

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4893>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of 
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
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-trac?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to