maxon.Pair

Description

maxon.Pair provides in-place static storage for elements of arbitrary types.
It is similar to a maxon.Tuple, but supports only 2 elements.

Inheritance diagram

Inheritance

Parent Class:

Child Class:

Methods Signature

Get(ELEMENTTYPE)

Returns an entry of the Pair.

GetFirst()

Retrieves the first entry stored in the maxon.Pair.

GetSecond()

Retrieves the second entry stored in the maxon.Pair.

GetTypeArguments()

Retrieves the maxon.DataType from an argument

Set(ELEMENTTYPE, obj)

Defines a value of the Pair.

SetReturnType(type)

Defines the returned type.

__getitem__(index)

Gets the item at the given index in the pair.

__init__(typename)

Initializes the appropriate C++ Data object and store it within the _data member.

__iter__()

Iterates over the two elements of the pair.

__maxon_convert__([expected])

__setitem__(key, value)

Sets the item for the given index in the pair.

Methods Definition

Pair.Get(ELEMENTTYPE)

Returns an entry of the Pair.

Parameters

ELEMENTTYPE (int) – The index of the element to retrieve from the this maxon.Pair.

Returns

The data stored

Return type

maxon.Data

Pair.GetFirst()

Retrieves the first entry stored in the maxon.Pair.

Returns

The first entry of this maxon.Pair.

Return type

maxon.Data

Pair.GetSecond()

Retrieves the second entry stored in the maxon.Pair.

Returns

The second entry of this maxon.Pair.

Return type

maxon.Data

Pair.GetTypeArguments()

Retrieves the maxon.DataType from an argument

Returns

The list of argument and maxon.DataType.

Return type

list[maxon.DataType, type)

Pair.Set(ELEMENTTYPE, obj)

Defines a value of the Pair.

Parameters
  • ELEMENTTYPE (int) – The index of the element to set the value from the this maxon.Pair.

  • obj (maxon.Data) – The data to store stored

Pair.SetReturnType(type)

Defines the returned type.

Parameters

type – The return type expected.

Type

type

Pair.__getitem__(index)

Gets the item at the given index in the pair.

Parameters

index (int) – The index to retrieve the value for.

Raises

IndexError – When index is out of bounds.

Returns

The retrieved item.

Return type

maxon.Data

Pair.__init__(typename)

Initializes the appropriate C++ Data object and store it within the _data member.

If C is a Data then _data store a copy the C++ Data is done and stored.
If C is a C++ Data then _data store a reference of the C++ Data.
If C is not defined the C++ data is created and stored in the _data member.
Parameters

C (Union[None, maxon.Data]) – Input data from which the Data should be created.

Pair.__iter__()

Iterates over the two elements of the pair.

Pair.__maxon_convert__(expected=None)
Pair.__setitem__(key, value)

Sets the item for the given index in the pair.

Parameters
  • index (int) – The index of the value to set.

  • value (Optional[maxon.Data]) – The value to set for index.

Raises

IndexError – When index is out of bounds.