-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
pydrake symbolic: Disable Formula.__nonzero__ #8500
pydrake symbolic: Disable Formula.__nonzero__ #8500
Conversation
+@soonho-tri for feature review, please. Review status: 0 of 6 files reviewed at latest revision, all discussions resolved. Comments from Reviewable |
Review status: 0 of 6 files reviewed at latest revision, all discussions resolved, some commit checks failed. bindings/pydrake/util/pure_hash_dict.py, line 19 at r1 (raw file):
For now, we have Comments from Reviewable |
Review status: 0 of 6 files reviewed at latest revision, 1 unresolved discussion, some commit checks failed. bindings/pydrake/util/pure_hash_dict.py, line 19 at r1 (raw file): Previously, soonho-tri (Soonho Kong) wrote…
FYI/FWIW, #8510 is merged. Comments from Reviewable |
65121d0
to
31424a7
Compare
Review status: 0 of 6 files reviewed at latest revision, 1 unresolved discussion. bindings/pydrake/util/pure_hash_dict.py, line 19 at r1 (raw file): Previously, soonho-tri (Soonho Kong) wrote…
Done. Comments from Reviewable |
Checkpoint with a few questions/BTWs. Reviewed 5 of 8 files at r2. bindings/pydrake/symbolic_py.cc, line 331 at r2 (raw file):
Do we need to disable bindings/pydrake/util/containers.py, line 75 at r2 (raw file):
What's the motivation to keep it (or make it as a default)? bindings/pydrake/util/containers.py, line 95 at r2 (raw file):
BTW, @gizatt wants to have a dictionary whose key can be either a bindings/pydrake/util/containers.py, line 99 at r2 (raw file):
I guess it's safer to have Also, I'm wondering if it makes sense 1) first to check lhs/rhs have the same type, 2) if the type provides Comments from Reviewable |
Review status: 4 of 6 files reviewed at latest revision, 4 unresolved discussions, some commit checks failed. bindings/pydrake/symbolic_py.cc, line 331 at r2 (raw file): Previously, soonho-tri (Soonho Kong) wrote…
OK We only need to disable bindings/pydrake/util/containers.py, line 75 at r2 (raw file): Previously, soonho-tri (Soonho Kong) wrote…
OK I prefer to build rather complex behavior like this on generic types - however, this class doesn't have to be public, so I'll go ahead and hide it. bindings/pydrake/util/containers.py, line 95 at r2 (raw file): Previously, soonho-tri (Soonho Kong) wrote…
OK Yes, that is what this class is meant for - any class which, when compared with something, returns bindings/pydrake/util/containers.py, line 99 at r2 (raw file): Previously, soonho-tri (Soonho Kong) wrote…
OK I'm not sure what we gain by checking the type: If Comments from Reviewable |
@drake-jenkins-bot test linux-xenial-clang-bazel-experimental-debug please. |
@drake-jenkins-bot linux-xenial-clang-bazel-experimental-debug please |
31424a7
to
776e4b1
Compare
Review status: 3 of 6 files reviewed at latest revision, 3 unresolved discussions. bindings/pydrake/util/containers.py, line 75 at r2 (raw file): Previously, EricCousineau-TRI (Eric Cousineau) wrote…
Done. Realized that you were right to make the base functionality private; made that change. bindings/pydrake/util/containers.py, line 99 at r2 (raw file): Previously, EricCousineau-TRI (Eric Cousineau) wrote…
Done. Realize that yes, it's safe as it would avoid an exception (was not thinking about that!). Comments from Reviewable |
Review status: 3 of 6 files reviewed at latest revision, all discussions resolved. bindings/pydrake/test/symbolic_test.py, line 496 at r4 (raw file):
This line fails on macOS (+ on a Ubuntu machine as well):
Comments from Reviewable |
Huh... That's odd (well, more odd than the nominal behavior). Can I ask which version of NumPy you have on both of those OSes? (I'm assuming both are Python 2.7.12) |
FYI,
Review status: 3 of 6 files reviewed at latest revision, 1 unresolved discussion. Comments from Reviewable |
Used a Will codify that in the test; even though both behaviors are unwanted, I'd still like to have knowledge of what to expect. Review status: 3 of 6 files reviewed at latest revision, 1 unresolved discussion. Comments from Reviewable |
Seems that the change may have been in v1.13.0, under the heading " |
Review status: 3 of 6 files reviewed at latest revision, 1 unresolved discussion. bindings/pydrake/test/symbolic_test.py, line 496 at r4 (raw file): Previously, soonho-tri (Soonho Kong) wrote…
Done. Comments from Reviewable |
1e5111b
to
d2f7255
Compare
Seems that this behavior raises a I've found the two warnings particular to these errors, and have now promoted to them errors, which should now resolve usability issues #8315, at least as far as error reporting goes. Confirmed that this works for v1.11.0 (my system), v1.13.3, and v1.14.2 on Ubuntu. |
+@jwnimmer-tri for platform-review, please. Reviewed 2 of 2 files at r3, 5 of 5 files at r5. bindings/pydrake/test/symbolic_test.py, line 886 at r5 (raw file):
FYI, this is because Comments from Reviewable |
Checkpoint. Reviewed 1 of 8 files at r2, 2 of 2 files at r3, 4 of 5 files at r5. bindings/pydrake/symbolic_py.cc, line 341 at r5 (raw file):
FYI We might as well spell out the full module path for this? bindings/pydrake/util/containers.py, line 7 at r5 (raw file):
I don't see why EqualToDict would do this, when regular dict doesn't? If the value type disobeys the bindings/pydrake/util/containers.py, line 18 at r5 (raw file):
FYI Does this deserve a string message? Or is it unreachable? bindings/pydrake/util/containers.py, line 28 at r5 (raw file):
The meaning of bindings/pydrake/util/containers.py, line 28 at r5 (raw file):
The meaning of key_wrap and key_unwrap are unclear. I guess they are both supposed to quack like single-argument functors? bindings/pydrake/util/deprecation.py, line 143 at r5 (raw file):
I think this comment needs to be about 10x larger, explaining what is going on, why we choose to filter it, whether certain numpy versions are affected, etc. -- basically everything you've learned about these deprecation things should be dumped into the comment here. As it stands, I have no way to reason about the justification for this code, nor any idea how to explore or test it. Comments from Reviewable |
d2f7255
to
88a91eb
Compare
Review status: 4 of 8 files reviewed at latest revision, 7 unresolved discussions. bindings/pydrake/symbolic_py.cc, line 341 at r5 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. bindings/pydrake/test/symbolic_test.py, line 886 at r5 (raw file): Previously, soonho-tri (Soonho Kong) wrote…
Done. Looks better now, thanks! bindings/pydrake/util/containers.py, line 7 at r5 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. bindings/pydrake/util/containers.py, line 18 at r5 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. bindings/pydrake/util/containers.py, line 28 at r5 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. bindings/pydrake/util/containers.py, line 28 at r5 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. bindings/pydrake/util/deprecation.py, line 143 at r5 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. Comments from Reviewable |
88a91eb
to
d5ecc9b
Compare
Reviewed 3 of 4 files at r6. Comments from Reviewable |
Reviewed 1 of 4 files at r6. bindings/pydrake/test/symbolic_test.py, line 886 at r5 (raw file): Previously, EricCousineau-TRI (Eric Cousineau) wrote…
Should this comment still be here? At least, I don't understand what it means now. bindings/pydrake/test/symbolic_test.py, line 41 at r6 (raw file):
FYI Consider renaming this to bindings/pydrake/test/symbolic_test.py, line 477 at r6 (raw file):
BTW abbreviation bindings/pydrake/test/symbolic_test.py, line 885 at r6 (raw file):
BTW typo Comments from Reviewable |
Reviewed 4 of 4 files at r6. bindings/pydrake/test/symbolic_test.py, line 37 at r6 (raw file):
BTW, to be precise, Comments from Reviewable |
d5ecc9b
to
ae62d4e
Compare
Review status: 7 of 8 files reviewed at latest revision, 5 unresolved discussions. bindings/pydrake/test/symbolic_test.py, line 886 at r5 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. Oops! bindings/pydrake/test/symbolic_test.py, line 37 at r6 (raw file): Previously, soonho-tri (Soonho Kong) wrote…
Done. bindings/pydrake/test/symbolic_test.py, line 41 at r6 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. bindings/pydrake/test/symbolic_test.py, line 477 at r6 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. bindings/pydrake/test/symbolic_test.py, line 885 at r6 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. (Removed) Comments from Reviewable |
Reviewed 1 of 1 files at r7. Comments from Reviewable |
ae62d4e
to
a4845dd
Compare
Reviewed 2 of 2 files at r8. Comments from Reviewable |
Closes #8491
Note that this doesn't really help out with #8315 -- in fact, it may worsen the behavior, as NumPy seems to have odd behavior: If the elements are equal but
__nonzero__
is disabled, then NumPy will return an array ofTrue
s (possibly based on the identity of the arrays themselves?). If the elements are unequal, then NumPy will return a scalarFalse
.This does not address conversion for
bool
in the C++ code, as I would prefer to focus on the Python portion of things to better facilitate PR #8452.This change is