-
Notifications
You must be signed in to change notification settings - Fork 327
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
define separate semantics for $
, and [[
#255
Conversation
For what it's worth, some of the surprise here might've arisen from how Pandas defines the
However, if an attribute (method) of the same name exists, then that is chosen instead:
|
47f0b76
to
692aff3
Compare
To help preserve backwards compatibility, I've decided on the following:
This should ensure the least amount of breakage in existing code, but it does imply a change in this case for example:
Previously, |
R/python.R
Outdated
|
||
# convert | ||
if (convert || py_is_callable(attrib)) { | ||
if (py_has_attr(x, name)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These checks should only occur if the user is passing in a scalar string (length one character vector).
@kevinushey Is this good to merge? |
I want to double-check this doesn't regress anything in keras or tensorflow so I'll report back after testing a bit there. |
Okay, you can go ahead and merge whenever you think it's ready. |
Tests pass with both |
I don’t see any warnings. I think it’s quite error-prone to have all operators do everything without any way being the right one. |
Related: #251
This PR seeks to define different semantics for
$
and[[
. With this PR:$
is used for attribute access, as Python's.
is used;[[
is used for item access, as Python's[[
is used.For backwards compatibility, with Python (builtin) dictionaries,
$
still returns items rather than attributes. We may want to consider changing this in the future.