#10651: Make a good use of the EmptySetError in EnumeratedSets and Parent
---------------------------------------------------------------+------------
   Reporter:  nborie                                           |       Owner:  
nborie                          
       Type:  defect                                           |      Status:  
needs_review                    
   Priority:  major                                            |   Milestone:  
sage-4.7                        
  Component:  categories                                       |    Keywords:  
days28, empty set, EmptySetError
     Author:  Nicolas Borie, Nicolas M. Thiéry                 |    Upstream:  
N/A                             
   Reviewer:  Paul Zimmermann, Robert Bradshaw, Nicolas Borie  |      Merged:   
                               
Work_issues:                                                   |  
---------------------------------------------------------------+------------
Changes (by newvalueoldvalue):

  * status:  needs_work => needs_review
  * author:  Nicolas Borie => Nicolas Borie, Nicolas M. Thiéry
 * cc: hivert (removed)
 * cc: nthiery (added)
  * reviewer:  Paul Zimmermann => Paul Zimmermann, Robert Bradshaw, Nicolas
               Borie


Old 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:
> }}}

New 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)

 ...


 StopIteration:
 sage:
 }}}

 Also, make the EmptySetError being documented already in the structure of
 Parent. Improve the documentation of an_element and _an_element_ in
 Parent.

--

Comment:

 In order to fix more things in the same time, I update the description of
 this ticket. I folded the NT'reviewer from the sage-combinat queue, then I
 uploaded the patch with a better commit message.

 I am very OK with the changes in the Parent structure from Nicolas Thiéry.
 I give a positive review on all changes touching the corresponding file.
 The first part of the patch still comes from me, so no review from me.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10651#comment:14>
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.

Reply via email to