APL and Ultra Field Types for Python (4.0)

The following APL and Ultra field types are supported. 

Field Type

Python Type

Description

Field Type

Python Type

Description

any

drany

Can be assigned any value of any supported type.

An actual value can never be of type drany, an actual value is always of one of the supported types.

An any field may also hold an unknown value, and the value will then be an instance of DRRemoteObject.

See the examples below:

udr.anyField = 4096 isinstance(udr.anyField, drint) # True udr.anyField = "a string" isinstance(udr.anyField, drstring) # True udr.anyField = drbyte(3) isinstance(udr.anyField, drbyte) # True isinstance(udr.anyField, drany) # Always False



bytearray

drbytearray

Bytearray type.

The type drbytearray is the same as the Python built in bytearray type.

See the examples below:

udr.baField = drbytearray([1,2,3]) udr.baField = bytearray([1,2,3])



boolean

drboolean

Boolean value (True or False).

The type drboolean is the same as the Python built in bool type.

See the example below:

udr.booleanField = True



byte

drbyte

Single byte integer value. See the example below:



short

drshort

Short integer value. See the example below:



int

drint

Integer value. See the example below:



long

drlong

Long integer value. See the example below:



bigint

drbigint

Storage for any integer value. See the examples below:



bigdec

drbigdec

Storage for any integer value with a decimal point.

The type drbigdec is the same as the Python built-in type decimal.Decimal, except that drbigdec only accepts finite values.

See the example below:



float

drfloat

Single-precision floating point.

Avoid using float, use double instead.

See the example below:



double

drdouble

Double-precision floating point.

The type drdouble is the same as the Python built in float type.

See the example below:



char

drchar

A single character value.

See the example below:



string

drstring

A string value.

The type drstring is the same as the Python built in unicode type on Python 2 and str on Python 3.

See the example below:



date

drdate

A date value.

Dates are represented as UNIX timestamps and hold information on:

  • timestamp - the timestamp as a float in seconds

  • timezone - the timezone as a string as supported by APL

  • hastime - true if the timestamp has time information

  • hasdate - true if the timestamp has date information

See the example below:

The string representation of date always presents the timestamp in UTC. See the drdate example below:

To create a date representing now, use:

To create a date with only the hastime or hasdate information use:

To create a date with a timestamp specified in seconds as a float (timezone is optional) use:



Note!

The timestamp must be a float.

To compare drdates use their timestamps.

A date cannot be modified after construction.

ipaddress

dripaddress

Holds IP address information. Both IPv4 and IPv6 are supported.

Use the property ipaddress to get the IP address as a string.

See the example below:



bitset

drbitset

Represents a bit string that grows as needed. The bits are indexed by non-negative integers. See the example below:



table

drtable

A special type used to hold table data used by the APL table commands.

The drtable does not hold the actual table data but is only a reference to the data.

To access the actual rows and columns you must import and use APL functions to extract the information.

See the example below:



list

drlist

List of objects of a specified type, implements the Python collections.abc.MutableSequence interface. See the example below:



map

drmap

Hash map of specified key/value types, implements the Python collections.abc.MutableMapping interface. See the example below:



drudr

drudr

Holds a UDR object.

The actual runtime type of the UDR can be checked with isinstance.

See the example below:

The Python agents are aware of all UDR types and field types that exist. When assigning fields,  automatic type conversion is always performed and includes converting numbers to booleans, strings to numbers, numbers to strings, and dictionaries to UDRs.

In case types or values mismatch, assigning to a field may result in an exception.