heyoka.func_args#

class heyoka.func_args#

Class to represent sets of function arguments.

Added in version 8.0.0.

This class is used to represent the arguments of a function expression. The arguments are stored internally as a list of expression and they can be accessed via the args property.

Upon construction, the user can select whether the arguments are stored using value or reference semantics. In the former case, when the func_args instance is copied (either directly via the use of functions such as copy()/deepcopy() or indirectly through the expression API), a new copy of the list of arguments is created for each new func_args instance. In the latter case, multiple copies of a func_args contain references to a single shared instance of the list of arguments.

The default behaviour throughout heyoka.py is to use value semantics. Reference semantics is used in specific situations where it can bring substantial performance benefits.

Methods

__init__(self[, args, shared])

Constructor.

Attributes

args

The list of function arguments.

is_shared

Flag signalling the use of reference or value semantics.

__init__(self, args: Iterable[expression] = [], shared: bool = False)#

Constructor.

This constructor will construct an instance of func_args storing the arguments args. If the boolean flag shared is True, then reference semantics will be used, otherwise value semantics will be employed.

Parameters:
  • args – the input set of arguments.

  • shared – the boolean flag selecting value or reference semantics.

property args#

The list of function arguments.

Return type:

list[expression]

property is_shared#

Flag signalling the use of reference or value semantics.

The flag is True if reference semantics is being used to represent the arguments, False otherwise.

Return type:

bool