Ticket #11370 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

permutation.to_standard() breaks on empty permutations

Reported by: hivert Owned by: sage-combinat
Priority: major Milestone: sage-4.7.1
Component: combinatorics Keywords: Standard permutation
Cc: combinat Work issues:
Report Upstream: N/A Reviewers: Mike Hansen
Authors: Florent Hivert Merged in: sage-4.7.1.alpha3
Dependencies: Stopgaps:

Description (last modified by hivert) (diff)

Yet another empty object problem

sage: sage.combinat.permutation.to_standard([])
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)

/home/data/Sage-Install/sage-4.6.2/devel/sage-combinat/sage/combinat/<ipython console> in <module>()

/home/florent/src/Sage/sage/local/lib/python2.6/site-packages/sage/combinat/permutation.pyc in to_standard(p)
   4243 
   4244     s = p[:]
-> 4245     biggest = max(p) + 1
   4246     i = 1
   4247     for _ in range(len(p)):

ValueError: max() arg is an empty sequence

should be

[]

I also fixed the return type of {{{from_reduced_word([])}}.

Attachments

trac_11370-perm_empty_standard_fix-fh.patch Download (1.2 KB) - added by hivert 2 years ago.

Change History

comment:1 Changed 2 years ago by hivert

  • Description modified (diff)

comment:2 Changed 2 years ago by hivert

  • Cc combinat added

Should be ready for review.

Changed 2 years ago by hivert

comment:3 Changed 2 years ago by mhansen

  • Status changed from new to needs_review
  • Reviewers set to Mike Hansen

Looks good to me.

comment:4 Changed 2 years ago by mhansen

  • Status changed from needs_review to positive_review

comment:5 Changed 2 years ago by hivert

Thanks Mike.

comment:6 Changed 2 years ago by jdemeyer

  • Status changed from positive_review to closed
  • Resolution set to fixed
  • Merged in set to sage-4.7.1.alpha3
Note: See TracTickets for help on using tickets.