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

Replace 'signature' argument in apply_ufunc with *_core_dims #1245

Merged
merged 2 commits into from
Feb 7, 2017

Conversation

shoyer
Copy link
Member

@shoyer shoyer commented Feb 2, 2017

This results in a much easier to use function signature than the previous
signature argument which required triply nested lists.

e.g., new:

def inner_product(a, b, dim):
    return apply_ufunc(_inner, a, b, input_core_dims=[[dim], [dim]])

vs. old:

def inner_product(a, b, dim):
    return apply_ufunc(_inner, a, b, signature=[[[dim], [dim]], []])

I also was able to remove the code related to parsing gufunc signatures from strings.

  • tests added / passed
  • passes git diff upstream/master | flake8 --diff

This results in a much easier to use function signature than the previous
`signature` argument which required triply nested lists.

e.g., new:

    def inner_product(a, b, dim):
        return apply_ufunc(_inner, a, b, input_core_dims=[[dim], [dim]])

vs. old:

    def inner_product(a, b, dim):
        return apply_ufunc(_inner, a, b, signature=[[[dim], [dim]], []])
@rabernat
Copy link
Contributor

rabernat commented Feb 3, 2017

I like the new syntax much better. I spent 45 minutes trying to figure out the correct signature.

@shoyer shoyer changed the title Replace 'signature' argument to apply_func with *_core_dims Replace 'signature' argument in uapply_func with *_core_dims Feb 4, 2017
@shoyer shoyer changed the title Replace 'signature' argument in uapply_func with *_core_dims Replace 'signature' argument in apply_ufunc with *_core_dims Feb 4, 2017
@shoyer shoyer merged commit d49014d into pydata:master Feb 7, 2017
@shoyer shoyer deleted the apply_ufunc_signature branch September 17, 2017 05:04
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.

2 participants