friendlysam.opt.VariableCollection.__call__

VariableCollection.__call__(index)

Get a variable from the collection.

A VariableCollection is callable. You call the object to get a Variable from the collection.

Parameters:index (hashable object) – The index of the requested variable.
Returns:class:VariableCollection has not been called earlier with this index, creates a new Variable instance and returns it.

If the index has been used before, the same Variable instance will be returned.

Return type:If the

Examples

>>> x = VariableCollection('x')
>>> x
<friendlysam.opt.VariableCollection at 0x...: x>
>>> x(1)
<friendlysam.opt.Variable at 0x...: x(1)>