Overview

The Python Component Bindings provide language bindings to Python for the Component Interface. 1262 is the current Python binding and should be used for all new Python components. This allows you to author your component as a Python function that receives events from the framework. Python developers will find this approach much more natural, and much less work, than authoring a C component.

Usage

As with all the bindings, you should create a new Process for this binding using the BRAHMS Manager, which will be based on the template.

Considerations

  • Since Python is not a compiled language, certain types of processes authored in Python may run slower (including, much slower) than if they had been written in a compiled language.
  • Since Python does not currently provide a thread-safe engine, processes authored against these bindings cannot be run concurrently in the same memory space (this will be enforced by the framework). They can be run concurrently in different memory spaces using Concerto, however.

Array Ordering

1262 presents data as NumPy arrays in row-major format, with the last dimension being the fastest varying. This means that if you pass in a 2x3x4 numeric array to a 1262 process, it will be presented within your process code as a 4x3x2 NumPy array. A future binding may reverse this decision; I'm not familiar enough with NumPy to know what a Python developer would prefer.

Numeric Storage Format

1262 sets complex storage format and array order flags when calling EVENT_GENERIC_STRUCTURE_SET and EVENT_GENERIC_STRUCTURE_GET. This will affect the generic structure interface for some data objects. For instance, std/data/numeric will not return, and should not be passed, string parts indicating these structure aspects.