Name
get
Synopsis
PyObjectinterp
.get(Stringname
) Objectinterp
.get(Stringname
,Classjavaclass
)
Fetches the value of the attribute named
name
from
interp
’s namespace. The
overload with two arguments also converts the value to the specified
javaclass
, throwing a Java
PyException
exception that wraps a Python
TypeError
if the conversion is unfeasible. Either
overload raises a NullPointerException
if
name
is unbound. Typical use of the
two-argument form might be a Java statement such as:
String s = (String)interp.get("attname", String.class);
Get Python in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.