Opened 10 years ago

Last modified 10 years ago

#10651 closed defect

Small fix in `_an_element_from_iterator` in EnumeratedSets — at Initial Version

Reported by: nborie Owned by: nborie
Priority: major Milestone: sage-4.7
Component: categories Keywords: days28, empty set, EmptySetError
Cc: sage-combinat Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

As Florent Hivert gave extremely useful features about empty things, we should use it. The Following should returns an EmptySetError?

sage: S = Set([])
sage: S.an_element()
---------------------------------------------------------------------------
StopIteration                             Traceback (most recent call last)

/opt/sage/devel/sage-combinat/<ipython console> in <module>()

/opt/sage/local/lib/python2.6/site-packages/sage/misc/cachefunc.pyc in __call__(self, *args, **kwds)
    329             2
    330          """
--> 331         return self._cachedmethod._instance_call(self._instance, *args, **kwds)
    332 
    333     def get_cache(self, *args, **kwds):

/opt/sage/local/lib/python2.6/site-packages/sage/misc/cachefunc.pyc in _instance_call(self, inst, *args, **kwds)
    473             return cache[key]
    474         else:
--> 475             cache[key] = self._cachedfunc.f(inst, *args, **kwds)
    476             return cache[key]
    477 

/opt/sage/local/lib/python2.6/site-packages/sage/categories/enumerated_sets.pyc in _an_element_from_iterator(self)
    470             """
    471             it = self.__iter__()
--> 472             return it.next()
    473 
    474         # Should this be implemented from first instead?

StopIteration: 
sage: 

Change History (0)

Note: See TracTickets for help on using tickets.