ItemSpace#

class ItemSpace(_impl)[source]#

Root dynamic space created by calling a parameterized UserSpace with arguments.

ItemSpace is a subclass of DynamicSpace that represents the top-level space instance for a specific set of parameter values. When a UserSpace has a parameter formula defined, accessing it with arguments (via [] subscription or () call) creates an ItemSpace that serves as the root of a dynamic space hierarchy.

Each ItemSpace:

  • Corresponds to a unique combination of parameter values

  • Contains cells with formulas inherited from the base UserSpace

  • Creates child DynamicSpaces for any nested spaces in the base

  • Is cached and reused when accessed with the same arguments

Creation:

ItemSpaces are created automatically when a parameterized UserSpace is accessed with arguments:

>>> space = model.new_space()
>>> space.parameters = ('x', 'y')
>>> space[1, 2]  # Creates ItemSpace with x=1, y=2
<ItemSpace space[1, 2] in Model1>

Key Characteristics:

  • Root dynamic space: Top of the dynamic space hierarchy for given parameters

  • Parameterized: Has specific argument values (accessible via argvalues)

  • Read-only: Cannot be edited after creation

  • Cached: Same arguments return the same ItemSpace instance

  • Deletable: Can be removed via clear_at() or del space[args]

The key distinction from DynamicSpace:

  • ItemSpace = root of dynamic hierarchy (has parameters)

  • DynamicSpace = nested child within that hierarchy (no parameters)

See also

DynamicSpace: Non-root dynamic spaces in the hierarchy UserSpace: The base space that ItemSpace derives from UserSpace.parameters: Define parameters for a space

Added in version 0.0.21: Split from DynamicSpace class

Basic properties#

name

Name of the object.

fullname

Dotted name of the object.

doc

Documentation string

allow_none

Whether a cells can have None as its value.

model

The model this object belongs to.

parent

The parent of this object.

properties

refs

Read-only mapping of reference names to their values.

cur_space([name])

Set the current space to Space name and return it.

has_params()

Check whether this space has parameters defined.

set_property(name, value)

Set property name

info

An object whose repr summarizes this Interface.

Inheritance properties#

bases

List of base spaces from which this space inherits.

Child Space properties#

named_spaces

Read-only mapping of names to child UserSpace objects.

spaces

Read-only mapping of names to child UserSpace objects.

Child Cells properties#

cells

Read-only mapping of cells names to Cells objects.

ItemSpace properties#

argvalues

A tuple containing the argument values used to create this ItemSpace.

parameters

Tuple of parameter names for this space, or None if not parameterized.

Exporting to Pandas objects#

frame

Alias of to_frame().

to_frame(*args)

Convert cells in this space to a pandas DataFrame.