#12518: Enumerated set from iterator
------------------------------------------+--------------------------------
       Reporter:  vdelecroix              |        Owner:  vdelecroix
           Type:  enhancement             |       Status:  closed
       Priority:  major                   |    Milestone:  sage-5.6
      Component:  combinatorics           |   Resolution:  fixed
       Keywords:  set, iterator           |    Merged in:  sage-5.6.beta2
        Authors:  Vincent Delecroix       |    Reviewers:  Travis Scrimshaw
Report Upstream:  N/A                     |  Work issues:
         Branch:                          |       Commit:
   Dependencies:  #12653, #11795, #13778  |     Stopgaps:
------------------------------------------+--------------------------------

Comment (by jdemeyer):

 Could you please explain the motivation behind the doctests
 {{{
         TESTS::

             sage: from sage.sets.set_from_iterator import set_from_method
             sage: from sage.structure.misc import getattr_from_other_class
             sage: class A:
             ...      stop = 10000
             ...      @set_from_method
             ...      def f(self,start):
             ...          return xsrange(start,self.stop)
             sage: a = A()
             sage: getattr_from_other_class(a, A, 'f')(4)
             {4, 5, 6, 7, 8, ...}

             sage: class B:
             ...      stop = 10000
             ...      @set_from_method(category=FiniteEnumeratedSets())
             ...      def f(self,start):
             ...          return xsrange(start,self.stop)
             sage: b = B()
             sage: getattr_from_other_class(b, B, 'f')(2)
             {2, 3, 4, 5, 6, ...}
 }}}

 However, the documentation of `getattr_from_other_class` says:
 {{{
     If self is an instance of cls, raises an ``AttributeError``, to
     avoid a double lookup. This function is intended to be called from
     __getattr__, and so should not be called if name is an attribute
     of self.
 }}}

 But this is precisely what that doctest is doing! Due to a bug in
 `getattr_from_other_class` (see #17801), the `AttributeError` is not
 always raised when it should. The obvious fix for that bug gives doctest
 failures in the above doctests.

--
Ticket URL: <http://trac.sagemath.org/ticket/12518#comment:38>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to