#16913: Error in prev()
-------------------------------------+-------------------------------------
       Reporter:  ayyer              |        Owner:
           Type:  defect             |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-6.4
      Component:  combinatorics      |   Resolution:
       Keywords:  permutations,      |    Merged in:
  prev                               |    Reviewers:
        Authors:  André Apitzsch     |  Work issues:
Report Upstream:  N/A                |       Commit:
         Branch:                     |  a2406cd669acf5af044738f24c711b1f5526f3a5
  u/aapitzsch/ticket/16913           |     Stopgaps:
   Dependencies:                     |
-------------------------------------+-------------------------------------

Comment (by aapitzsch):

 Replying to [comment:2 vdelecroix]:
 >
 > - What about `range(n-2,-1,-1)` instead of `reversed(range(0,n-1))`?

 I prefer the latter because it's less error-prone and there is almost no
 difference in speed
 {{{
 $ python3 -m timeit -n 100 'for i in reversed(range(100000)): continue'
 100 loops, best of 3: 3.54 msec per loop
 $ python3 -m timeit -n 100 'for i in range(99999,-1,-1): continue'
 100 loops, best of 3: 3.55 msec per loop
 }}}

--
Ticket URL: <http://trac.sagemath.org/ticket/16913#comment:4>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to