Opened 8 years ago
Closed 2 years ago
#10948 closed defect (wontfix)
Calling point on an iterator of 3d points raises an AttributeError
Reported by: | slabbe | Owned by: | jason, was |
---|---|---|---|
Priority: | major | Milestone: | sage-duplicate/invalid/wontfix |
Component: | graphics | Keywords: | sd75 |
Cc: | kcrisman | Merged in: | |
Authors: | Sébastien Labbé | Reviewers: | |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
Drawing a list of 2d and 3d points works :
sage: point([(i,i) for i in range(10)]) sage: point([(i,i,i) for i in range(10)])
Drawing an iterator of 2d points works :
sage: point((i,i) for i in range(10))
Drawing an iterator of 3d points is broken :
sage: point((i,i,i) for i in range(10)) Traceback (most recent call last): ... AttributeError: 'int' object has no attribute '_set_extra_kwds'
The same bug is obtained for empty iterator :
sage: point([]) sage: point(iter([])) Traceback (most recent call last): ... AttributeError: 'int' object has no attribute '_set_extra_kwds'
Moreover, I wonder if the line 1022 of sage/plot/plot3d/shapes2.pyc in point3d(v, size, kwds)
A = sum([Point(z, size, **kwds) for z in v])
should be
A = sum([Point(z, size, **kwds) for z in v], Graphics())
or something?
Attachments (1)
Change History (13)
Changed 8 years ago by
comment:1 Changed 7 years ago by
- Cc kcrisman added
comment:2 Changed 7 years ago by
I think I left this ticket as "new" because I was not sure about my fix. My question was : Is it necessary to expand the iterator as a list to fix it?
The problem was that in the function point
, trying
point2d
on the iterator consumes it. Maybe
point2d
could do a copy of the iterator with
itertools.tee
before consuming it? I think such a fix would be better. What do you think?
Sébastien
comment:3 Changed 7 years ago by
Hmm, that is very subtle!
sage: A = ((i,i) for i in range(10)) sage: type(A) <type 'generator'> sage: point(A) <plots nicely> sage: A.next() -------------------------------------------------------------------- StopIteration:
Yeah, that's not a bad idea. Usually people wouldn't do this, but I can certainly see it happening.
On the other hand, if it slows the process of getting this fix in, we should probably open a different ticket for that.
So it's up to you. If you feel motivated to add this right now, then do it and the whole thing can be reviewed. Otherwise, set this to 'needs review' and open another ticket for that.
comment:4 Changed 5 years ago by
- Milestone changed from sage-5.11 to sage-5.12
comment:5 Changed 5 years ago by
- Milestone changed from sage-6.1 to sage-6.2
comment:6 Changed 5 years ago by
- Milestone changed from sage-6.2 to sage-6.3
comment:7 Changed 4 years ago by
- Milestone changed from sage-6.3 to sage-6.4
comment:8 Changed 2 years ago by
- Status changed from new to needs_review
I suggest to close this ticket as a duplicate of #14490.
comment:9 Changed 2 years ago by
- Keywords sd75 added
I am cleaning my old trac tickets during Sage Days 75.
comment:10 Changed 2 years ago by
- Milestone changed from sage-6.4 to sage-duplicate/invalid/wontfix
comment:11 Changed 2 years ago by
- Status changed from needs_review to positive_review
comment:12 Changed 2 years ago by
- Resolution set to wontfix
- Status changed from positive_review to closed
Determined to be invalid/duplicate/wontfix (closing as "wontfix" as a catch-all resolution).
See also #11426.