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
Added is_iterator method and fixes sage to use it. #7398
Comments
This comment has been minimized.
This comment has been minimized.
comment:2
Attachment: trac_7398_iter_detect-fh.patch.gz |
Attachment: trac_7398_iter_detect-fh.2.patch.gz Updated patch after review by Nicolas (uses itertools to simplify further sage.server.interact.list_of_first_n) |
comment:4
William: this makes a small edit to sage.server.notebook.interact.list_of_first_n You may want to check/backport to the notebook code |
This comment has been minimized.
This comment has been minimized.
Changed keywords from iterators to iterators, itertools |
comment:5
The given patch actually breaks somme code... I'm uploading a new one. |
comment:6
Attachment: trac_7398_iter_detect-fh.3.patch.gz Nicolas : can you re-review this patch... Sorry for the mess, Florent |
Attachment: trac_7398_combclass_set_compat-fh.patch.gz |
comment:7
The patch trac_7398_iter_detect-fh.3.patch broke something in graph_generators. Apply those two patches in that order. Cheers, Florent |
Merged: sage-4.2.1.rc0 |
The following mantra occurs at three places in Sage's code to test whether v is an iterator:
This is not quite correct since some sage objects have a next method without being iterable, or with a different semantic.
Let me quote python's doc:
Therefore here is the good way to test if an element is an iterator:
Note: it is not sufficient to check for the existence of the methods since some sage object implement
__iter__
to raise aNotImplemented
exception !Florent
CC: @sagetrac-sage-combinat @williamstein
Component: misc
Keywords: iterators, itertools
Author: Florent Hivert
Reviewer: Nicolas M. Thiéry
Merged: sage-4.2.1.rc0
Issue created by migration from https://trac.sagemath.org/ticket/7398
The text was updated successfully, but these errors were encountered: