next | previous | forward | backward | up | top | index | toc | Macaulay2 website
Python :: hasattr

hasattr -- whether a python object has an attribute

Synopsis

Description

This is equivalent to the Python hasattr function.

i1 : foo = rs "'Hello, world!'"

o1 = Hello, world!

o1 : PythonObject of class str
i2 : hasattr(foo, "upper")

o2 = true
i3 : hasattr(foo, "bar")

o3 = false

Ways to use hasattr :

For the programmer

The object hasattr is a method function.