type/python - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Data Types : Type Checking : Types : type/python

type/python

check for an object of type python

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

type(x, python)

Parameters

x

-

any expression

Description

• 

The call type(x, python) checks to see if x is of type python. It returns true if x is of type python, and false otherwise.

  

An object is of type python if it is a reference to an object from a Python session running alongside the current Maple session.

• 

Such objects may be created with commands from the Python package such as EvalFunction, EvalMember, EvalString, or GetVariable.

• 

The convert/python function can convert expressions in Maple into type python expressions which reference equivalent Python expressions.

• 

The following convert routines can convert expressions of type python to equivalent Maple expressions.

Array

equationlist

list

Matrix

MutableSet

record

set

table

Vector

Examples

Construct a Python set and check that it is of type python.

sPython:-EvalStringset([3,5,7])

s<Python object: {3, 5, 7}>

(1)

types&comma;python

true

(2)

Construct a Python list. Since conversion to Maple lists is automatic, the default result will not be of type python.

LPython:-EvalString[1,3,5,5,8]

L1&comma;3&comma;5&comma;5&comma;8

(3)

typeL&comma;python

false

(4)

If a Python object is explicitly requested, the result will be of type python.

LPython:-EvalString[1,3,5,5,8]&comma;output=python

L<Python object: [1, 3, 5, 5, 8]>

(5)

typeL&comma;python

true

(6)

The convert command can also construct Python expressions.

MMatrix0.0357116785741896&comma;0.959492426392903&comma;0.655740699156587&comma;0.792207329559554&comma;datatype=float8

M0.03571167857418960.9594924263929030.6557406991565870.792207329559554

(7)

typeM&comma;python

false

(8)

PMconvertM&comma;python

PM<Python object: [[0.03571168 0.95949243] [0.6557407 0.79220733]]>

(9)

typePM&comma;python

true

(10)

Compatibility

• 

The type/python command was introduced in Maple 2020.

• 

For more information on Maple 2020 changes, see Updates in Maple 2020.

See Also

Python

type