Ticket #11435 (closed defect: fixed)

Opened 2 years ago

Last modified 23 months ago

empty partition causes error for down_list

Reported by: pdehaye Owned by: sage-combinat
Priority: major Milestone: sage-4.7.2
Component: combinatorics Keywords:
Cc: jbandlow Work issues:
Report Upstream: N/A Reviewers: Nathann Cohen
Authors: Paul-Olivier Dehaye Merged in: sage-4.7.2.alpha1
Dependencies: Stopgaps:

Description

sage: p = Partition([])
sage: p.down_list()
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)

/Volumes/Scratch/Users/duser1/sage/<ipython console> in <module>()

/Users/duser1/sage/local/lib/python2.6/site-packages/sage/combinat/partition.pyc in down_list(self)
    643             [[2, 2, 1], [3, 1, 1], [3, 2]]
    644         """
--> 645         return [p for p in self.down()]
    646 
    647     def dominates(self, p2):

/Users/duser1/sage/local/lib/python2.6/site-packages/sage/combinat/partition.pyc in down(self)
    622                 yield Partition(p[:i] + [ p[i]-1 ] + p[i+1:])
    623 
--> 624         last = p[-1]
    625         if last == 1:
    626             yield Partition(p[:-1])

/Users/duser1/sage/local/lib/python2.6/site-packages/sage/combinat/combinat.pyc in __getitem__(self, key)
    905             <type 'list'>
    906         """
--> 907         return self._list.__getitem__(key)
    908 
    909     def __iter__(self):

IndexError: list index out of range
sage: 

Attachments

trac_11435-Downlist_on_empty_partition-pod.patch Download (1.6 KB) - added by pdehaye 2 years ago.

Change History

Changed 2 years ago by pdehaye

comment:1 Changed 2 years ago by pdehaye

  • Status changed from new to needs_review

fixed

comment:2 Changed 2 years ago by ncohen

  • Status changed from needs_review to positive_review

Good to go :-)

Nathann

comment:3 Changed 2 years ago by jdemeyer

  • Milestone changed from sage-4.7.1 to sage-4.7.2

comment:4 Changed 2 years ago by jdemeyer

Dear author/reviewer: please add your real name in the Author and Reviewer fields.

comment:5 Changed 2 years ago by ncohen

  • Reviewers set to Nathann Cohen
  • Authors set to Paul-Olivier Dehaye

comment:6 Changed 23 months ago by jdemeyer

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