# getattr -- get an attribute of a python object

## Synopsis

• Usage:
getattr(x, y)
x@@y
• Inputs:
• x, ,
• y, ,
• Outputs:

## Description

This is equivalent to the Python getattr function.

 i1 : foo = rs "'Hello, world!'" o1 = Hello, world! o1 : PythonObject of class str i2 : (getattr(foo, "upper"))() o2 = HELLO, WORLD! o2 : PythonObject of class str

In Python, "." is generally used as a shortcut for this function, but it is not easily overloadable in Macaulay2. Instead, @@ may be used for this purpose, as its precedence is similar to "." In this case, y need not be a string.

 i3 : foo@@lower() o3 = hello, world! o3 : PythonObject of class str

## Ways to use getattr :

• "getattr(PythonObject,String)"

## For the programmer

The object getattr is .