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

line() does not accept iterators #10478

Closed
dandrake opened this issue Dec 15, 2010 · 9 comments
Closed

line() does not accept iterators #10478

dandrake opened this issue Dec 15, 2010 · 9 comments

Comments

@dandrake
Copy link
Contributor

The line() function fails when given an iterator:

sage: line(iter([(0,0), (1,0), (2,2)]))
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
[...]
/opt/sage/local/lib/python2.6/site-packages/sage/plot/plot.pyc in xydata_from_point_list(points)
   2529             pass
   2530     
-> 2531     if len(points)>0 and len(list(points[0]))!=2:
   2532         raise ValueError, "points must have 2 coordinates in a 2d line"
   2533 

TypeError: object of type 'listiterator' has no len()

Component: graphics

Keywords: line plot iterator

Author: Dan Drake

Reviewer: Robert Bradshaw

Merged: sage-4.6.2.alpha1

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

@dandrake
Copy link
Contributor Author

comment:1

Here's a patch which corrects the problem, but on my test machine, I'm getting doctest errors in shapes2.py just like those reported at #9088:

sage -t  "devel/sage-hack/sage/plot/plot3d/shapes2.py"      
**********************************************************************
File "/home/drake/s/sage-4.6.1.alpha3/devel/sage-hack/sage/plot/plot3d/shapes2.py", line 706:
    sage: P.tachyon_repr(P.default_render_params())
Expected:
    'Sphere center 1.0 2.0 3.0 Rad 0.015 texture85'
Got:
    'Sphere center 1.0 2.0 3.0 Rad 0.015 texture139'
**********************************************************************
File "/home/drake/s/sage-4.6.1.alpha3/devel/sage-hack/sage/plot/plot3d/shapes2.py", line 723:
    sage: P.obj_repr(P.default_render_params())[0][0:2]
Expected:
    ['g obj_1', 'usemtl texture87']
Got:
    ['g obj_1', 'usemtl texture141']
**********************************************************************
File "/home/drake/s/sage-4.6.1.alpha3/devel/sage-hack/sage/plot/plot3d/shapes2.py", line 831:
    sage: L.tachyon_repr(L.default_render_params())[0]
Expected:
    'FCylinder base 1.0 0.0 0.0 apex 0.999950000417 0.00999983333417 0.0001 rad 0.005 texture127'
Got:
    'FCylinder base 1.0 0.0 0.0 apex 0.999950000417 0.00999983333417 0.0001 rad 0.005 texture181'
**********************************************************************

That ticket got merged and it doesn't look like anyone fixed those doctests, but they haven't been failing...so I'm not sure what's going on.

@dandrake
Copy link
Contributor Author

comment:2

I'm marking this as "needs review" because it is ready for review -- I hope someone can explain the above test failures so I can fix them.

@dandrake
Copy link
Contributor Author

Author: Dan Drake

@robertwb
Copy link
Contributor

comment:3

The doctest failures are due to an internal counter used for uniqification. You can just change them to the new output, or "texture..."

@dandrake
Copy link
Contributor Author

Attachment: trac_10478.patch.gz

@dandrake
Copy link
Contributor Author

comment:4

New patch up; I just used the new values for the textures to fix the doctests. Please review.

@robertwb
Copy link
Contributor

comment:5

Looks good to me.

@jdemeyer
Copy link

Reviewer: Robert Bradshaw

@jdemeyer
Copy link

Merged: sage-4.6.2.alpha1

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

5 participants