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

[Proposal] Callable without args is regarded as a simple object (not called) #127

Closed
wants to merge 2 commits into from
Closed

[Proposal] Callable without args is regarded as a simple object (not called) #127

wants to merge 2 commits into from

Conversation

mknkmyzk
Copy link
Contributor

As issue #123 pointed out, np.add.at does not work with pycall.
In Python, np.add is callable, e.g. we can call np.add(a, b).
However, in Python, np.add itself is an object and it is different from np.add().

On the other side, in Ruby, np.add has the same meaning as np.add().
So np.add.at equal to np.add().at, which causes this error.

My proposal is as follows:
if a callable object appear without args, it is treated as a simple object in pycall.

A bad side effect of this patch is that when we call a callable object without any args,
we cannot write lke 'foo' or 'foo()' but we must write like 'foo.()'.

Another side effect is that when we call a callable object with some args,
we can write not only 'foo(x)' but also 'foo.(x)'.

@mrkn
Copy link
Owner

mrkn commented Sep 23, 2020

The notation foo.() was employed before version 1.0.
But I decided to migrate the current form because Ruby is Lisp-2.
So this proposal is not acceptable.

By the way, I've recognized we need a useful shorthand notation of PyCall.getattr(obj, attr). I want to add such a feature if I find a good form.

@mknkmyzk
Copy link
Contributor Author

Thank you for your reply.
Ignoring foo.() is a design choice, and I agree your choice.

I think this patch may be useful for someone's reference, but you can close this pull request.

Best regards.

@mrkn
Copy link
Owner

mrkn commented Jan 11, 2021

@mknkmyzk Thank you for your feedback.

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