File: py_str.Rd

package info (click to toggle)
r-cran-reticulate 1.41.0.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,088 kB
  • sloc: cpp: 5,154; python: 620; sh: 13; makefile: 2
file content (41 lines) | stat: -rw-r--r-- 1,392 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/RcppExports.R, R/python.R
\name{py_repr}
\alias{py_repr}
\alias{py_str}
\title{String representation of a python object.}
\usage{
py_repr(object)

py_str(object, ...)
}
\arguments{
\item{object}{Python object}

\item{...}{Unused}
}
\value{
Character vector
}
\description{
This is equivalent to calling \code{str(object)} or \code{repr(object)} in Python.
}
\details{
In Python, calling \code{print()} invokes the builtin \code{str()}, while auto-printing
an object at the REPL invokes the builtin \code{repr()}.

In \R, the default print method for python objects invokes \code{py_repr()}, and
the default \code{format()} and \code{as.character()} methods invoke \code{py_str()}.

For historical reasons, \code{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 \code{format()} and/or \code{print()} S3 R method
for python objects instead.

The default implementation will call \code{PyObject_Str} on the object.
}
\seealso{
\code{\link[=as.character.python.builtin.str]{as.character.python.builtin.str()}}
\code{\link[=as.character.python.builtin.bytes]{as.character.python.builtin.bytes()}} for handling
\verb{Error : Embedded NUL in string.} if the Python string contains an embedded \code{NUL}.
}