Name

get

Synopsis

PyObject interp.get(String name)
Object interp.get(String name,Class javaclass)

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.