Opened 4 years ago
Last modified 3 years ago
#18400 new defect
Maximum recursion depth error when listing points of a projective space
Reported by: | vdelecroix | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-6.7 |
Component: | algebraic geometry | Keywords: | |
Cc: | ncohen | Merged in: | |
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | #18290 | Stopgaps: |
Description
sage: P = ProjectiveSpace(2,GF(2)) sage: P.point_set().list() Traceback (most recent call last): ... RuntimeError: maximum recursion depth exceeded in __instancecheck__
Change History (13)
comment:1 Changed 4 years ago by
- Dependencies set to #18290
comment:2 Changed 4 years ago by
comment:3 Changed 4 years ago by
Also:
sage: len(ProjectiveSpace(2,GF(2))) ... AttributeError: 'ProjectiveSpace_finite_field_with_category' object has no attribute 'list'
comment:4 Changed 4 years ago by
And
sage: len(ProjectiveSpace(2,GF(2)).point_set()) ... RuntimeError: maximum recursion depth exceeded while calling a Python object
comment:5 Changed 4 years ago by
apparently list()
calls len
, and len
calls list. I do not see anything wrong with the design.
comment:6 Changed 4 years ago by
The two examples in comment:3 and comment:4 are not exactly wrong in the same way. In algebraic geometry, a scheme is not a set. And indeed
sage: P = ProjectiveSapce(2,GF(2)) sage: P in Sets() False sage: P.point_set() in Sets() True
I do not understand why there is a __len__
implemented there! It is inherited from Parent
as
def __len__(self): return len(self.list())
Haaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
Vincent
comment:7 Changed 4 years ago by
First, what about removing the .list()
function, which returns tuple(self)
, i.e. a tuple?
comment:8 Changed 4 years ago by
What about removing .list()
from Parent
? God knows that I hate both Parent
and categories, but given that a Parent
is not necessarily a finite set it is not very smart to have it return the cardinality of the set after a full enumeration.
This 'len' should be in FiniteEnumerateSet
or whatever it is named nowadays.
comment:9 Changed 4 years ago by
See the 3 years old ticket #12955...
comment:10 follow-up: ↓ 11 Changed 4 years ago by
Oh. Then it is going to be addressed. Fine.
comment:11 in reply to: ↑ 10 Changed 4 years ago by
Replying to ncohen:
Oh. Then it is going to be addressed.
Some people thinks that opening a ticket solves an issue... I am worried by the "it is going to" which is a date between now and never (though the bound is strict on the right hand side).
comment:12 Changed 4 years ago by
Yeah. And the people who think that just got millions from Europe.
comment:13 Changed 3 years ago by
I just ran into this bug:
sage: P.<x,y> = ProjectiveSpace(1, QQ) sage: Q = P.subscheme(x - y) sage: S = Q.point_set() sage: S.points() [(1 : 1)] sage: S.list() Traceback (most recent call last): ... RuntimeError: maximum recursion depth exceeded in __instancecheck__
The easiest way to solve this is to make list()
an alias for points()
in sage.schemes.projective.projective_homset.SchemeHomset_points_projective_field
. Alternatively we could implement __iter__()
in this class and make points()
a wrapper around that.
Though, the following works