One Hat Cyber Team
Your IP :
216.73.216.80
Server IP :
194.44.31.54
Server :
Linux zen.imath.kiev.ua 4.18.0-553.77.1.el8_10.x86_64 #1 SMP Fri Oct 3 14:30:23 UTC 2025 x86_64
Server Software :
Apache/2.4.37 (Rocky Linux) OpenSSL/1.1.1k
PHP Version :
5.6.40
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
doc
/
Macaulay2
/
Python
/
html
/
View File Name :
___Python__Object.html
<!DOCTYPE html> <html lang="en"> <head> <title>PythonObject -- a python object</title> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> <link type="text/css" rel="stylesheet" href="../../../../Macaulay2/Style/doc.css"> <link rel="stylesheet" href="../../../../Macaulay2/Style/katex/katex.min.css"> <script defer="defer" src="../../../../Macaulay2/Style/katex/katex.min.js"></script> <script defer="defer" src="../../../../Macaulay2/Style/katex/contrib/auto-render.min.js"></script> <script> var macros = { "\\break": "\\\\", "\\ZZ": "\\mathbb{Z}", "\\NN": "\\mathbb{N}", "\\QQ": "\\mathbb{Q}", "\\RR": "\\mathbb{R}", "\\CC": "\\mathbb{C}", "\\PP": "\\mathbb{P}" }, delimiters = [ { left: "$$", right: "$$", display: true}, { left: "\\[", right: "\\]", display: true}, { left: "$", right: "$", display: false}, { left: "\\(", right: "\\)", display: false} ], ignoredTags = [ "kbd", "var", "samp", "script", "noscript", "style", "textarea", "pre", "code", "option" ]; document.addEventListener("DOMContentLoaded", function() { renderMathInElement(document.body, { delimiters: delimiters, macros: macros, ignoredTags: ignoredTags, trust: true }); }); </script> <style>.katex { font-size: 1em; }</style> <script defer="defer" src="../../../../Macaulay2/Style/katex/contrib/copy-tex.min.js"></script> <script defer="defer" src="../../../../Macaulay2/Style/katex/contrib/render-a11y-string.min.js"></script> <script src="../../../../Macaulay2/Style/prism.js"></script> <script>var current_version = '1.25.06';</script> <script src="../../../../Macaulay2/Style/version-select.js"></script> <link type="image/x-icon" rel="icon" href="../../../../Macaulay2/Style/icon.gif"> </head> <body> <div id="buttons"> <div> <a href="https://macaulay2.com/">Macaulay2</a> <span id="version-select-container"></span> » <a title="Macaulay2 documentation" href="../../Macaulay2Doc/html/index.html">Documentation </a> <br><a href="../../Macaulay2Doc/html/_packages_spprovided_spwith_sp__Macaulay2.html">Packages</a> » <span><a title="interface to Python" href="index.html">Python</a> :: <a title="a python object" href="___Python__Object.html">PythonObject</a></span> </div> <div class="right"> <form method="get" action="https://www.google.com/search"> <input placeholder="Search" type="text" name="q" value=""> <input type="hidden" name="q" value="site:macaulay2.com/doc"> </form> <a href="___Python__Object_sp~.html">next</a> | <a href="_python__Help.html">previous</a> | <a href="___Python__Object_sp~.html">forward</a> | <a href="_python__Help.html">backward</a> | up | <a href="master.html">index</a> | <a href="toc.html">toc</a> </div> </div> <hr> <div> <h1>PythonObject -- a python object</h1> <div> <h2>Description</h2> <div> <p>This type corresponds to all objects of the <span class="tt"><a href="https://docs.python.org/3/c-api/structures.html#c.PyObject">PyObject</a></span> type in the Python C API, and in particular all of the types that users are familiar with from the Python language itself.</p> </div> <div> <p>You can perform basic arithmetic on python objects.</p> </div> <table class="examples"> <tr> <td> <pre><code class="language-macaulay2">i1 : x = pythonValue "5" o1 = 5 o1 : PythonObject of class int</code></pre> </td> </tr> <tr> <td> <pre><code class="language-macaulay2">i2 : y = pythonValue "2" o2 = 2 o2 : PythonObject of class int</code></pre> </td> </tr> <tr> <td> <pre><code class="language-macaulay2">i3 : x + y o3 = 7 o3 : PythonObject of class int</code></pre> </td> </tr> <tr> <td> <pre><code class="language-macaulay2">i4 : x - y o4 = 3 o4 : PythonObject of class int</code></pre> </td> </tr> <tr> <td> <pre><code class="language-macaulay2">i5 : x * y o5 = 10 o5 : PythonObject of class int</code></pre> </td> </tr> <tr> <td> <pre><code class="language-macaulay2">i6 : x / y o6 = 2.5 o6 : PythonObject of class float</code></pre> </td> </tr> </table> <div> <p>You can also compare them.</p> </div> <table class="examples"> <tr> <td> <pre><code class="language-macaulay2">i7 : x > y o7 = true</code></pre> </td> </tr> <tr> <td> <pre><code class="language-macaulay2">i8 : x == y o8 = false</code></pre> </td> </tr> </table> <div> <p>You can also perform operations on python objects and Macaulay2 things. The results will be returned as python objects.</p> </div> <table class="examples"> <tr> <td> <pre><code class="language-macaulay2">i9 : x + 2 o9 = 7 o9 : PythonObject of class int</code></pre> </td> </tr> </table> <div> <p>Note that many keywords in Macaulay2 are mapped to a certain dunder method in Python. In particular,</p> </div> <ul> <li><span class="tt">+</span> → <span class="tt">__add__</span> (binary), <span class="tt">__pos__</span> (unary)</li> <li><span class="tt">-</span> → <span class="tt">__sub__</span> (binary), <span class="tt">__neg__</span> (unary)</li> <li><span class="tt">*</span> → <span class="tt">__mul__</span></li> <li><span class="tt">@</span> → <span class="tt">__matmul__</span></li> <li><span class="tt">/</span> → <span class="tt">__truediv__</span></li> <li><span class="tt">//</span> → <span class="tt">__floordiv__</span></li> <li><span class="tt">%</span> → <span class="tt">__mod__</span></li> <li><span class="tt">^</span> → <span class="tt">__pow__</span></li> <li><span class="tt"><<</span> → <span class="tt">__lshift__</span></li> <li><span class="tt">>></span> → <span class="tt">__rshift__</span></li> <li><span class="tt">&</span> → <span class="tt">__and__</span></li> <li><span class="tt">|</span> → <span class="tt">__or__</span></li> <li><span class="tt">^^</span> → <span class="tt">__xor__</span></li> <li><span class="tt">and</span> → <span class="tt">__and__</span></li> <li><span class="tt">or</span> → <span class="tt">__or__</span></li> <li><span class="tt">xor</span> → <span class="tt">__xor__</span></li> </ul> </div> <div> <div class="waystouse"> <h2>Methods that use a python object:</h2> <ul> <li><span><span class="tt">?? PythonObject</span> (missing documentation)<!--tag: (??,PythonObject)--> </span></li> <li><span><a title="absolute value of a python object" href="_abs_lp__Python__Object_rp.html">abs(PythonObject)</a> -- absolute value of a python object</span></li> <li><span><a title="ceiling of a python object" href="_ceiling_lp__Python__Object_rp.html">ceiling(PythonObject)</a> -- ceiling of a python object</span></li> <li><span><span class="tt">describe(PythonObject)</span> (missing documentation)<!--tag: (describe,PythonObject)--> </span></li> <li><span><span class="tt">expression(PythonObject)</span> (missing documentation)<!--tag: (expression,PythonObject)--> </span></li> <li><span><a title="floor of a python object" href="_floor_lp__Python__Object_rp.html">floor(PythonObject)</a> -- floor of a python object</span></li> <li><span><kbd>getattr(PythonObject,String)</kbd> -- see <span><a title="get an attribute of a python object" href="_getattr.html">getattr</a> -- get an attribute of a python object</span></span></li> <li><span><kbd>PythonObject @@ Thing</kbd> -- see <span><a title="get an attribute of a python object" href="_getattr.html">getattr</a> -- get an attribute of a python object</span></span></li> <li><span><kbd>getitem(PythonObject,Thing)</kbd> -- see <span><a title="get elements of python sequences" href="_getitem.html">getitem</a> -- get elements of python sequences</span></span></li> <li><span><kbd>PythonObject _ Thing</kbd> -- see <span><a title="get elements of python sequences" href="_getitem.html">getitem</a> -- get elements of python sequences</span></span></li> <li><span><kbd>hasattr(PythonObject,String)</kbd> -- see <span><a title="whether a python object has an attribute" href="_hasattr.html">hasattr</a> -- whether a python object has an attribute</span></span></li> <li><span><a title="documentation for python object" href="_help_lp__Python__Object_rp.html">help(PythonObject)</a> -- documentation for python object</span></li> <li><span><kbd>isMember(PythonObject,PythonObject)</kbd> -- see <span><a title="test membership in a python object" href="_is__Member_lp__Thing_cm__Python__Object_rp.html">isMember(Thing,PythonObject)</a> -- test membership in a python object</span></span></li> <li><span><a title="test membership in a python object" href="_is__Member_lp__Thing_cm__Python__Object_rp.html">isMember(Thing,PythonObject)</a> -- test membership in a python object</span></li> <li><span><a title="get iterator of iterable python object" href="_iterator_lp__Python__Object_rp.html">iterator(PythonObject)</a> -- get iterator of iterable python object</span></li> <li><span><a title="returns the length of a python object" href="_length_lp__Python__Object_rp.html">length(PythonObject)</a> -- returns the length of a python object</span></li> <li><span><span class="tt">net(PythonObject)</span> (missing documentation)<!--tag: (net,PythonObject)--> </span></li> <li><span><a title="retrieve the next item from a python iterator" href="_next_lp__Python__Object_rp.html">next(PythonObject)</a> -- retrieve the next item from a python iterator</span></li> <li><kbd>+ PythonObject</kbd></li> <li><kbd>- PythonObject</kbd></li> <li><kbd>PythonObject % PythonObject</kbd></li> <li><kbd>PythonObject % Thing</kbd></li> <li><kbd>PythonObject & PythonObject</kbd></li> <li><kbd>PythonObject & Thing</kbd></li> <li><kbd>PythonObject * PythonObject</kbd></li> <li><kbd>PythonObject * Thing</kbd></li> <li><kbd>PythonObject + PythonObject</kbd></li> <li><kbd>PythonObject + Thing</kbd></li> <li><kbd>PythonObject - PythonObject</kbd></li> <li><kbd>PythonObject - Thing</kbd></li> <li><kbd>PythonObject / PythonObject</kbd></li> <li><kbd>PythonObject / Thing</kbd></li> <li><kbd>PythonObject // PythonObject</kbd></li> <li><kbd>PythonObject // Thing</kbd></li> <li><kbd>PythonObject << PythonObject</kbd></li> <li><kbd>PythonObject << Thing</kbd></li> <li><kbd>PythonObject == PythonObject</kbd></li> <li><kbd>PythonObject == Thing</kbd></li> <li><kbd>PythonObject >> PythonObject</kbd></li> <li><kbd>PythonObject >> Thing</kbd></li> <li><kbd>PythonObject ? PythonObject</kbd></li> <li><kbd>PythonObject ? Thing</kbd></li> <li><kbd>PythonObject @ PythonObject</kbd></li> <li><kbd>PythonObject @ Thing</kbd></li> <li><kbd>PythonObject ^ PythonObject</kbd></li> <li><kbd>PythonObject ^ Thing</kbd></li> <li><kbd>PythonObject ^^ PythonObject</kbd></li> <li><kbd>PythonObject ^^ Thing</kbd></li> <li><kbd>PythonObject | PythonObject</kbd></li> <li><kbd>PythonObject | Thing</kbd></li> <li><kbd>PythonObject and PythonObject</kbd></li> <li><kbd>PythonObject and Thing</kbd></li> <li><kbd>PythonObject or PythonObject</kbd></li> <li><kbd>PythonObject or Thing</kbd></li> <li><kbd>PythonObject xor PythonObject</kbd></li> <li><kbd>PythonObject xor Thing</kbd></li> <li><kbd>Thing % PythonObject</kbd></li> <li><kbd>Thing & PythonObject</kbd></li> <li><kbd>Thing * PythonObject</kbd></li> <li><kbd>Thing + PythonObject</kbd></li> <li><kbd>Thing - PythonObject</kbd></li> <li><kbd>Thing / PythonObject</kbd></li> <li><kbd>Thing // PythonObject</kbd></li> <li><kbd>Thing << PythonObject</kbd></li> <li><kbd>Thing == PythonObject</kbd></li> <li><kbd>Thing >> PythonObject</kbd></li> <li><kbd>Thing ? PythonObject</kbd></li> <li><kbd>Thing @ PythonObject</kbd></li> <li><kbd>Thing ^ PythonObject</kbd></li> <li><kbd>Thing ^^ PythonObject</kbd></li> <li><kbd>Thing | PythonObject</kbd></li> <li><kbd>Thing and PythonObject</kbd></li> <li><kbd>Thing or PythonObject</kbd></li> <li><kbd>Thing xor PythonObject</kbd></li> <li><span><span class="tt">PythonObject %= Thing</span> (missing documentation)<!--tag: (%=,PythonObject)--> </span></li> <li><span><span class="tt">PythonObject &= Thing</span> (missing documentation)<!--tag: (&=,PythonObject)--> </span></li> <li><span><span class="tt">PythonObject *= Thing</span> (missing documentation)<!--tag: (*=,PythonObject)--> </span></li> <li><span><span class="tt">PythonObject += Thing</span> (missing documentation)<!--tag: (+=,PythonObject)--> </span></li> <li><span><span class="tt">PythonObject -= Thing</span> (missing documentation)<!--tag: (-=,PythonObject)--> </span></li> <li><span><span class="tt">PythonObject //= Thing</span> (missing documentation)<!--tag: (//=,PythonObject)--> </span></li> <li><span><span class="tt">PythonObject /= Thing</span> (missing documentation)<!--tag: (/=,PythonObject)--> </span></li> <li><span><span class="tt">PythonObject <<= Thing</span> (missing documentation)<!--tag: (<<=,PythonObject)--> </span></li> <li><span><span class="tt">PythonObject >>= Thing</span> (missing documentation)<!--tag: (>>=,PythonObject)--> </span></li> <li><span><span class="tt">PythonObject @= Thing</span> (missing documentation)<!--tag: (@=,PythonObject)--> </span></li> <li><span><span class="tt">PythonObject ^= Thing</span> (missing documentation)<!--tag: (^=,PythonObject)--> </span></li> <li><span><span class="tt">PythonObject ^^= Thing</span> (missing documentation)<!--tag: (^^=,PythonObject)--> </span></li> <li><span><span class="tt">PythonObject |= Thing</span> (missing documentation)<!--tag: (|=,PythonObject)--> </span></li> <li><span><a title="bitwise not of a python object" href="___Python__Object_sp~.html">PythonObject ~</a> -- bitwise not of a python object</span></li> <li><span><a title="quotient and remainder of python objects" href="_quotient__Remainder_lp__Python__Object_cm__Python__Object_rp.html">quotientRemainder(PythonObject,PythonObject)</a> -- quotient and remainder of python objects</span></li> <li><span><kbd>quotientRemainder(PythonObject,Thing)</kbd> -- see <span><a title="quotient and remainder of python objects" href="_quotient__Remainder_lp__Python__Object_cm__Python__Object_rp.html">quotientRemainder(PythonObject,PythonObject)</a> -- quotient and remainder of python objects</span></span></li> <li><span><kbd>quotientRemainder(Thing,PythonObject)</kbd> -- see <span><a title="quotient and remainder of python objects" href="_quotient__Remainder_lp__Python__Object_cm__Python__Object_rp.html">quotientRemainder(PythonObject,PythonObject)</a> -- quotient and remainder of python objects</span></span></li> <li><span><kbd>round(PythonObject)</kbd> -- see <span><a title="round a python object" href="_round_lp__Z__Z_cm__Python__Object_rp.html">round(ZZ,PythonObject)</a> -- round a python object</span></span></li> <li><span><kbd>round(PythonObject,PythonObject)</kbd> -- see <span><a title="round a python object" href="_round_lp__Z__Z_cm__Python__Object_rp.html">round(ZZ,PythonObject)</a> -- round a python object</span></span></li> <li><span><a title="round a python object" href="_round_lp__Z__Z_cm__Python__Object_rp.html">round(ZZ,PythonObject)</a> -- round a python object</span></li> <li><span><kbd>PythonObject @@ Thing = Thing</kbd> -- see <span><a title="set an attribute of a python object" href="_setattr.html">setattr</a> -- set an attribute of a python object</span></span></li> <li><span><kbd>setattr(PythonObject,String,Thing)</kbd> -- see <span><a title="set an attribute of a python object" href="_setattr.html">setattr</a> -- set an attribute of a python object</span></span></li> <li><span><kbd>PythonObject _ Thing = Thing</kbd> -- see <span><a title="set elements of mutable python sequences" href="_setitem.html">setitem</a> -- set elements of mutable python sequences</span></span></li> <li><span><kbd>setitem(PythonObject,Thing,Thing)</kbd> -- see <span><a title="set elements of mutable python sequences" href="_setitem.html">setitem</a> -- set elements of mutable python sequences</span></span></li> <li><span><span class="tt">texMath(PythonObject)</span> (missing documentation)<!--tag: (texMath,PythonObject)--> </span></li> <li><span><span class="tt">toExternalString(PythonObject)</span> (missing documentation)<!--tag: (toExternalString,PythonObject)--> </span></li> <li><span><kbd>PythonObject Thing</kbd> -- see <span><a title="convert callable python objects to Macaulay2 functions" href="_to__Function.html">toFunction</a> -- convert callable python objects to Macaulay2 functions</span></span></li> <li><span><kbd>toFunction(PythonObject)</kbd> -- see <span><a title="convert callable python objects to Macaulay2 functions" href="_to__Function.html">toFunction</a> -- convert callable python objects to Macaulay2 functions</span></span></li> <li><span><kbd>toPython(PythonObject)</kbd> -- see <span><a title="convert Macaulay2 things to Python objects" href="_to__Python.html">toPython</a> -- convert Macaulay2 things to Python objects</span></span></li> <li><span><span class="tt">toString(PythonObject)</span> (missing documentation)<!--tag: (toString,PythonObject)--> </span></li> <li><span><a title="truncate a python object" href="_truncate_lp__Python__Object_rp.html">truncate(PythonObject)</a> -- truncate a python object</span></li> <li><span><a title="convert python objects to Macaulay2 things" href="_value_lp__Python__Object_rp.html">value(PythonObject)</a> -- convert python objects to Macaulay2 things</span></li> </ul> </div> <div class="waystouse"> <h2>For the programmer</h2> <p>The object <a title="a python object" href="___Python__Object.html">PythonObject</a> is <span>a <a title="the class of all mutable types" href="../../Macaulay2Doc/html/___Type.html">type</a></span>, with ancestor class <a title="the class of all things" href="../../Macaulay2Doc/html/___Thing.html">Thing</a>.</p> </div> <hr> <div class="waystouse"> <p>The source of this document is in <span class="tt">Python/doc.m2:130:0</span>.</p> </div> </div> </div> </body> </html>