Macaulay2 » Documentation
Packages » Python » PythonObject » PythonObject @@ Thing = Thing
next | previous | forward | backward | up | index | toc

# PythonObject @@ Thing = Thing -- set an attribute of a python object

- Operator: @@
- Usage:
    `x@@y = e`
- Inputs:
  - x, a python object,
  - y, a thing,
  - e, a thing,

## Description

This is equivalent to the Python setattr function. Note that e is converted to a Python object using toPython.

    i1 : math = import "math"

    o1 = <module 'math' (built-in)>

    o1 : PythonObject of class module

    i2 : math@@pi = 22/7

    i3 : math@@pi

    o3 = 3.142857142857143

    o3 : PythonObject of class float

## Ways to use this method:

- PythonObject @@ Thing = Thing -- set an attribute of a python object

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/Python/doc.m2:622:0.