Getting Started
Installation
To get started with cereal, install the library:
Linux/macOS
python3 -m pip install -U cereal-py
Windows
py -3 -m pip install -U cereal-py
Python 3.6+ is required
Learn about Pointers in Python:
Catch up to speed on Pointers using the docs for ZeroIntensity's: pointers.py. strongly recommended to understand how to access / store values
Create your first Cereal Pointer:
import numpy as np
from cereal import eat
x = [1, 2, 3, 4] # simple list
yum = eat(x, its = 4, np.array, copy = False) # repeat x 4 times into a numpy array, do not copy the data
>> yum
>> array([<pointer to list object at 0x113b3edc0>,
<pointer to list object at 0x113b3edc0>,
<pointer to list object at 0x113b3edc0>,
<pointer to list object at 0x113b3edc0>], dtype=object) # 4 pointers to the original object
>>> yum[0]
<pointer to list object at 0x113b3edc0>
>>> (~yum[0])[0] # ternary ~, dereferences the pointer. * also works
1
yum[0][0] = 4 # item assignment
>>> x # the original object
[4, 2, 3, 4] # it changed!