#14583: Permutation('()') and Permutation(''), each in its own way, fail to 
return
the identity in S_0
----------------------------------+-----------------------------------------
       Reporter:  darij           |         Owner:  sage-combinat
           Type:  defect          |        Status:  needs_review 
       Priority:  major           |     Milestone:  sage-5.10    
      Component:  combinatorics   |    Resolution:               
       Keywords:  combinat        |   Work issues:               
Report Upstream:  N/A             |     Reviewers:               
        Authors:  Darij Grinberg  |     Merged in:               
   Dependencies:                  |      Stopgaps:               
----------------------------------+-----------------------------------------
Changes (by {'newvalue': u'Darij Grinberg', 'oldvalue': ''}):

 * cc: tscrim, nthiery (added)
  * status:  new => needs_review
  * author:  => Darij Grinberg


Old description:

> I brought this up in #8392 but was told to post it as a new ticket.
>
> {{{
> sage: Permutation([])  # This is be the identity permutation in S_0.
> []
> sage: Permutation([]).cycle_string()    # OK.
> '()'
> sage: Permutation('()')    # This should give the S_0 identity back --
> but it doesn't.
> [1]
> sage: Permutation('')     # Does this maybe? No.
> ---------------------------------------------------------------------------
> ValueError                                Traceback (most recent call
> last)
> <ipython-input-29-3df27d9d4d7a> in <module>()
> ----> 1 Permutation('')
>
> /home/darij/sage-5.10.beta2/local/lib/python2.7/site-
> packages/sage/combinat/permutation.pyc in Permutation(l, check_input)
>     430         cycle_list = []
>     431         for c in cycles:
> --> 432             cycle_list.append(map(int, c.split(",")))
>     433
>     434         return from_cycles(max([max(c) for c in cycle_list]),
> cycle_list)
>
> ValueError: invalid literal for int() with base 10: ''
> sage: Permutation(())       # What about this?
> [1]
>
> }}}
>
> A corner case it is, but I think it should be done right...

New description:

 I brought this up in #8392 but was told to post it as a new ticket.

 {{{
 sage: Permutation([])  # This is be the identity permutation in S_0.
 []
 sage: Permutation([]).cycle_string()    # OK.
 '()'
 sage: Permutation('()')    # This should give the S_0 identity back -- but
 it doesn't.
 [1]
 sage: Permutation('')     # Does this maybe? No.
 ---------------------------------------------------------------------------
 ValueError                                Traceback (most recent call
 last)
 <ipython-input-29-3df27d9d4d7a> in <module>()
 ----> 1 Permutation('')

 /home/darij/sage-5.10.beta2/local/lib/python2.7/site-
 packages/sage/combinat/permutation.pyc in Permutation(l, check_input)
     430         cycle_list = []
     431         for c in cycles:
 --> 432             cycle_list.append(map(int, c.split(",")))
     433
     434         return from_cycles(max([max(c) for c in cycle_list]),
 cycle_list)

 ValueError: invalid literal for int() with base 10: ''
 sage: Permutation(())       # What about this?
 [1]

 }}}

 A corner case it is, but I think it should be done right...

 This is now fixed in the attached patch.

--

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/14583#comment:3>
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to