#13742: No Permutation should be created that its method cannot handle
---------------------------------+------------------------------------------
       Reporter:  ncohen         |         Owner:  sage-combinat
           Type:  defect         |        Status:  needs_work   
       Priority:  major          |     Milestone:  sage-5.6     
      Component:  combinatorics  |    Resolution:               
       Keywords:                 |   Work issues:               
Report Upstream:  N/A            |     Reviewers:               
        Authors:  Nathann Cohen  |     Merged in:               
   Dependencies:                 |      Stopgaps:               
---------------------------------+------------------------------------------

Comment (by dimpase):

 another thing: one can still create a "permutation" which is not a
 permutation, and get an error:
 {{{
 sage: p=Permutation([3,4,5,1])
 sage: p.is_even()
 ---------------------------------------------------------------------------
 IndexError                                Traceback (most recent call
 last)

 /usr/local/src/sage/sage-5.5.rc0/devel/sage-main/<ipython console> in
 <module>()

 /usr/local/src/sage/sage-5.5.rc0/local/lib/python2.7/site-
 packages/sage/combinat/permutation.pyc in is_even(self)
     859         """
     860
 --> 861         if self.signature() == 1:
     862             return True
     863         else:

 /usr/local/src/sage/sage-5.5.rc0/local/lib/python2.7/site-
 packages/sage/combinat/permutation.pyc in signature(p)
     842             1
     843         """
 --> 844         return (-1)**(len(p)-len(p.to_cycles()))
     845
     846     #one can also use sign as an alias for signature

 /usr/local/src/sage/sage-5.5.rc0/local/lib/python2.7/site-
 packages/sage/combinat/permutation.pyc in to_cycles(self, singletons)
     652             while next != cycleFirst:
     653                 cycle.append( next )
 --> 654                 l[next - 1], next  = False, l[next - 1]
     655             #Add the cycle to the list of cycles
     656             if singletons or len(cycle) > 1:

 IndexError: list index out of range
 }}}
 (many other functions of p will error out, too)
 Any plans to deal with this?

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13742#comment:18>
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 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