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

Add handle::repr() method #333

Merged
merged 1 commit into from Aug 14, 2016
Merged

Add handle::repr() method #333

merged 1 commit into from Aug 14, 2016

Conversation

aldanor
Copy link
Member

@aldanor aldanor commented Aug 13, 2016

A very simple PR, add handle::repr() method.

@aldanor
Copy link
Member Author

aldanor commented Aug 14, 2016

Oh great, Windows and Python 2 strike back 🔫

https://bugs.python.org/issue706263

@dean0x7d
Copy link
Member

This would be very easy to confuse with Python's regular print which does something entirely different. It's the same problem that py::str currently has, i.e. it doesn't do what you would expect from Python (which makes it easier to make a mistake). Besides, the overloaded operator<< already does half of this as just std::cout << obj;. Perhaps introduce a repr function which can be used as std::cout << py::repr(obj)?

@aldanor
Copy link
Member Author

aldanor commented Aug 14, 2016

Makes sense, agreed. So the only real missing part is repr() then.

I've added handle::repr(), if this looks ok, I'll squash this.

@aldanor aldanor changed the title Add pybind11::print() function Add handle::repr() method Aug 14, 2016
@aldanor
Copy link
Member Author

aldanor commented Aug 14, 2016

Squashed.

@wjakob
Copy link
Member

wjakob commented Aug 14, 2016

LGTM, thanks!

@wjakob wjakob merged commit 6fc7a30 into pybind:master Aug 14, 2016
@rwgk rwgk mentioned this pull request Feb 9, 2023
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.

None yet

3 participants