Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling point on an iterator of 3d points raises an AttributeError #10948

Closed
seblabbe opened this issue Mar 16, 2011 · 8 comments
Closed

Calling point on an iterator of 3d points raises an AttributeError #10948

seblabbe opened this issue Mar 16, 2011 · 8 comments

Comments

@seblabbe
Copy link
Contributor

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?

CC: @kcrisman

Component: graphics

Keywords: sd75

Author: Sébastien Labbé

Issue created by migration from https://trac.sagemath.org/ticket/10948

@kcrisman
Copy link
Member

kcrisman commented Jun 3, 2011

comment:1

Attachment: trac_10948_point3d-sl.patch.gz

See also #11426.

@seblabbe
Copy link
Contributor Author

seblabbe commented Jun 8, 2011

comment:2

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

@kcrisman
Copy link
Member

kcrisman commented Jun 8, 2011

comment:3

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.

@kcrisman
Copy link
Member

kcrisman commented Jun 8, 2011

Author: Sébastien Labbé

@jdemeyer jdemeyer modified the milestones: sage-5.11, sage-5.12 Aug 13, 2013
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.1, sage-6.2 Jan 30, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.2, sage-6.3 May 6, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.3, sage-6.4 Aug 10, 2014
@seblabbe
Copy link
Contributor Author

comment:8

I suggest to close this ticket as a duplicate of #14490.

@seblabbe
Copy link
Contributor Author

Changed keywords from none to sd75

@seblabbe
Copy link
Contributor Author

comment:9

I am cleaning my old trac tickets during Sage Days 75.

@fchapoton fchapoton removed this from the sage-6.4 milestone Aug 26, 2016
@embray
Copy link
Contributor

embray commented Aug 30, 2016

comment:12

Determined to be invalid/duplicate/wontfix (closing as "wontfix" as a catch-all resolution).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants