This is equivalent to calling str(object)
or repr(object)
in Python.
py_repr(object)py_str(object, ...)
Character vector
Python object
Unused
In Python, calling print()
invokes the builtin str()
, while auto-printing
an object at the REPL invokes the builtin repr()
.
In R, the default print method for python objects invokes py_repr()
, and
the default format()
and as.character()
methods invoke py_str()
.
For historical reasons, py_str()
is also an R S3 method that allows R
authors to customize the the string representation of a Python object from R.
New code is recommended to provide a format()
and/or print()
S3 R method
for python objects instead.
The default implementation will call PyObject_Str
on the object.