Opened 11 years ago

Closed 11 years ago

#11370 closed defect (fixed)

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 Merged in: sage-4.7.1.alpha3
Authors: Florent Hivert Reviewers: Mike Hansen
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by hivert)

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)
   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 (1)

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

Download all attachments as: .zip

Change History (7)

comment:1 Changed 11 years ago by hivert

  • Description modified (diff)

comment:2 Changed 11 years ago by hivert

  • Cc combinat added

Should be ready for review.

comment:3 Changed 11 years ago by mhansen

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

Looks good to me.

comment:4 Changed 11 years ago by mhansen

  • Status changed from needs_review to positive_review

comment:5 Changed 11 years ago by hivert

Thanks Mike.

comment:6 Changed 11 years ago by jdemeyer

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