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

BUG: Made setp accept arbitrary iterables #6217

Merged
merged 1 commit into from
Mar 26, 2016

Conversation

madphysicist
Copy link
Contributor

Previously only accepted sequences.

Fixes #6212

@madphysicist
Copy link
Contributor Author

I don't think the broken Travis test is something I did...

@madphysicist
Copy link
Contributor Author

Also, while looking through some old code, I found the original use-case where this came up. It's actually not too contrived: pyplot.setp(axes.spines.values(), color='gray'). Fine in Py2, breaks in Py3.

@tacaswell
Copy link
Member

There are a transient failures that we have not tracked down yet, restarted the test.

@@ -1526,12 +1529,12 @@ def setp(obj, *args, **kwargs):
>>> setp(line)
... long output listing omitted

:func:`setp` operates on a single instance or a list of instances.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While minor, I think you should absorb the doc changes into your PR.

@tacaswell
Copy link
Member

I think both of the fixes need to go in. One issue with listifying generators in functions is the side effect, ex

def worker(inp):
    inner = list(inp)
    print("should count to {}".format(len(inner)))


gen_example = (j for j in range(15))

worker(gen_example)
for i in gen_example:
    print(i)

will not behave correctly (you can make this sort of thing work via tee).

Previously only accepted sequences.
Fixes matplotlib#6212

Shamelessly borrows from `FIX: handle arbitrary iterables in setp matplotlib#6220`
@tacaswell
Copy link
Member

I am leaning no on backporting unless someone disagrees.

@madphysicist
Copy link
Contributor Author

That makes perfect sense in this case. As the title indicates, this is not strictly even a bug. If it hasn't been fixed by now, it's been worked around or gone unnoticed. The work-around is simple enough that it doesn't need a backport.

@madphysicist madphysicist deleted the madphysicist-patch-1 branch March 26, 2016 12:38
@QuLogic QuLogic added this to the 2.1 (next point release) milestone Jul 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants