#10651: Small fix in `_an_element_from_iterator` in EnumeratedSets
--------------------------+-------------------------------------------------
Reporter: nborie | Owner: nborie
Type: defect | Status: new
Priority: major | Milestone: sage-4.6.2
Component: categories | Keywords: empty set, EmptySetError
Author: | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
--------------------------+-------------------------------------------------
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:
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10651>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.