Uh oh!
There was an error while loading. Please reload this page.
pytypes: Add Gotchas section about default-constructed wrapper types and py::none() - #2362
Conversation
EricCousineau-TRI
commented
Aug 3, 2020
This is the "document the status quo" solution. I'm a bit fearful about changing the behavior just yet, but will speak more to that in the issue. |
0a31d0e to
4577989CompareEricCousineau-TRI
commented
Aug 4, 2020
Man... trying to explain this contract and compare against other languages was a bit of a fun exercise... |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
YannickJadoul
commented
Aug 4, 2020
I also find this very confusing, actually. What's happening:
So actually, I don't see what's wrong/broken in pybind11, and what should need explaining. This addition to the docs seems disproportionally large to me, for what's basically consistent behavior (pybind11-bound functions are consistent with Python, C++ functions are consistent with C++)? This PR seems to add to the confusion between the actual "C++ interface for Python" with the "overload resolution of bound functions to Python". I also strongly object against mentioning Java and C# in our docs. This is about Python and C++, and they both have a different way of handling variable. Basically, Java and C# (non-primitive) variables are all pointers and those pointers can be a null pointer. Python variables work differently, since you bind a name to an object. And the singleton NB: |
EricCousineau-TRI
commented
Aug 9, 2020
I'm down for reducing the volume of the text, but I do feel that it's an edge case worth mentioning. We've spent time hashing out this behavior here and in the issue, so I believe that is sufficient evidence that it does need explaining, but perhaps more briefly.
I'm good with that. I intended to capture this as a rather complex contract, but yes, relating to Java or C# may confuse the point further.
Good point!
Yup! Hence only capturing this as documentation, rather than vying for a change in functionality. |
4c697b9 to
dc9e30dCompareUh oh!
There was an error while loading. Please reload this page.
YannickJadoul
left a comment
There was a problem hiding this comment.
OK, my original comment/review was quite harsh, looking back at it, now. Sorry :-|
But I do like this better, actually. It feels like less of a single use-case story, and more to the point.
Thanks for actually creating this PR, @EricCousineau-TRI! :-)
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
# Conflicts: # docs/advanced/pycpp/object.rst
Resolves#2361 (through docs)