1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/python.R
\name{py_bool}
\alias{py_bool}
\title{Python Truthiness}
\usage{
py_bool(x)
}
\arguments{
\item{x, }{A python object.}
}
\value{
An R scalar logical: \code{TRUE} or \code{FALSE}. If \code{x} is a
null pointer or Python is not initialized, \code{FALSE} is returned.
}
\description{
Equivalent to \code{bool(x)} in Python, or \verb{not not x}.
}
\details{
If the Python object defines a \verb{__bool__} method, then that is invoked.
Otherwise, if the object defines a \verb{__len__} method, then \code{TRUE} is
returned if the length is nonzero. If neither \verb{__len__} nor \verb{__bool__}
are defined, then the Python object is considered \code{TRUE}.
}
|