next up previous contents index
Next: Global or local variable Up: Object status in SIC: Previous: Object status in SIC:   Contents   Index

Read-only or read-and-write?

Read or write status is preserved when variables are imported in Python, and trying to modify their values will raise an error:
>>> pi
>>> print pi.__doc__ # pi was imported from SIC
A SicVar instance.
>>> pi[0] = 0
Traceback (most recent call last):
  File "<STDIN>", line 1, in <module>
  File "/home/bardeau/gildas/gildas-src-dev/pc-fedora6-ifort/kernel/
python/", line 204, in __setitem__
    raise PygildasValueError, "Variable is read-only in SIC."
pgutils.PygildasValueError: Variable is read-only in SIC.

The protection of SicVar intances against deletion or re-definition (ie using pi = 1 instead of pi[0] = 1) is not implemented. See considerations in subsection 2.4.2.

Gildas manager 2014-07-01