Opened 12 years ago

Closed 11 years ago

#8613 closed defect (duplicate)

__dir__() / tab completion returns nonexistent attributes

Reported by: mmezzarobba Owned by: somebody
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: categories Keywords:
Cc: Merged in:
Authors: Reviewers: Simon King
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

On the following example, tab completion suggests sum, which is not an attribute of R.

sage: R = QQ['t']
sage: R.su       
R.sum                               R.summation
R.summation_from_element_class_add             
sage: R.sum                                    
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)

/home/marc/co/sage-4.3.4/<ipython console> in <module>()

/home/marc/co/sage-4.3.4/local/lib/python2.6/site-packages/sage/structure/parent.so in sage.structure.parent.Parent.__getattr__ (sage/structure/parent.c:5120)()

/home/marc/co/sage-4.3.4/local/lib/python2.6/site-packages/sage/structure/parent.so in sage.structure.parent.raise_attribute_error (sage/structure/parent.c:2638)()                                                                             

AttributeError: 'PolynomialRing_field' object has no attribute 'sum'
sage: 'sum' in R.__dir__()
True

Change History (7)

comment:1 Changed 12 years ago by was

Notice also that other longer summation_from_element_class_add:

sage: search_src('summation_from_element_class_add')
categories/commutative_additive_semigroups.py:121:        summation_from_element_class_add = summation
categories/commutative_additive_semigroups.py:136:            if (self.summation != self.summation_from_element_class_add) and hasattr(self, "element_class") and hasattr(self.element_class, "_add_parent"):

So, this suggests that this bug has something to do with Nicolas's category theory rewrite? I'll post to sage-combinat.

comment:2 Changed 12 years ago by was

This issue happens in both the notebook and command line.

comment:3 Changed 11 years ago by nthiery

This should be fixed once #9138 will be implemented.

comment:4 Changed 11 years ago by SimonKing

  • Status changed from new to needs_review

comment:5 Changed 11 years ago by SimonKing

  • Milestone changed from sage-4.7 to sage-duplicate/invalid/wontfix
  • Reviewers set to Simon King
  • Status changed from needs_review to positive_review

Indeed, it is a duplicate.

With the patches from #9944 and #9138, one obtains:

sage: R = QQ['t']
sage: R.sum
<bound method PolynomialRing_field_with_category.sum of Univariate Polynomial Ring in t over Rational Field>
sage: R.summ
R.summation                         R.summation_from_element_class_add
sage: R.summation_from_element_class_add
<bound method PolynomialRing_field_with_category.summation of Univariate Polynomial Ring in t over Rational Field>

I learnt: In that case, one should give a ticket a positive review and choose the milestone "duplicate", so that the release manager may close it.

comment:6 Changed 11 years ago by SimonKing

PS: #9138 needs review (hint...)

comment:7 Changed 11 years ago by jdemeyer

  • Resolution set to duplicate
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.