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

MAINT: Change complex parameter to boolean in Y_() #5209

Merged
merged 1 commit into from Oct 10, 2015

Conversation

Projects
None yet
2 participants
@endolith
Copy link
Contributor

endolith commented Aug 30, 2015

y0_zeros, y1_zeros, and y1p_zeros were using complex={0, 1} as
a boolean parameter. Changed to True or False, while still backwards
compatible.

This will also let the underlying function reject invalid values like complex=2

y0_zeros(2,2)
Traceback (most recent call last):
...
error: ((kc==0)||(kc==1)) failed for 3rd argument kc: cyzo:kc=2
MAINT: Change complex parameter to boolean in Y_()
y0_zeros, y1_zeros, and y1p_zeros were using complex={0, 1} as
a boolean parameter.  Changed to True or False, while still backwards
compatible.

@endolith endolith force-pushed the endolith:boolean_special branch from f44aa1a to fd7b831 Sep 1, 2015

@endolith

This comment has been minimized.

Copy link
Contributor Author

endolith commented Sep 1, 2015

Whoops. Force pushed a working version. This does not fail for complex=2, though.

@rgommers

This comment has been minimized.

Copy link
Member

rgommers commented Oct 9, 2015

@endolith is this still a working version, or did you re-push?

@endolith

This comment has been minimized.

Copy link
Contributor Author

endolith commented Oct 10, 2015

This is the re-pushed working version, yes.

If you call it with complex=2 though, it will just silently interpret that as True, which is how it currently behaves, but maybe shouldn't?

@rgommers rgommers added this to the 0.17.0 milestone Oct 10, 2015

@rgommers

This comment has been minimized.

Copy link
Member

rgommers commented Oct 10, 2015

If you call it with complex=2 though, it will just silently interpret that as True, which is how it currently behaves, but maybe shouldn't?

This is the case for pretty much all functions that accept boolean parameters, and is the expected behavior. Basically we document that it's a bool, treat it like a bool, so everything that can be evaluated as bool(input_param) works. Python duck-typing.

rgommers added a commit that referenced this pull request Oct 10, 2015

Merge pull request #5209 from endolith/boolean_special
MAINT: Change complex parameter to boolean in Y_()

@rgommers rgommers merged commit 5390ca2 into scipy:master Oct 10, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@rgommers

This comment has been minimized.

Copy link
Member

rgommers commented Oct 10, 2015

Merged, thanks @endolith

@endolith endolith deleted the endolith:boolean_special branch Oct 10, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.