Skip to main content

Create an iterable set of pointers to a specified length. Utilities for working with ZeroIntensity's pointers.py

Project description

cereal

Parallelization requires tools to reference data without overuse of memory, cereal allows you to reference PyObjects to pointers without creating a deep copy in memory. Inspired by ZeroIntensity's pointers.py.

import numpy as np
from cereal import eat

x = [1, 2, 3, 4]

yum = eat(x, its = 4, np.array, copy = False)

>> 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])[0]
>> 1

yum[0][0] = 4

>> x # the original object
>> [4, 2, 3, 4] # it changed!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cereal-py-1.0.tar.gz (3.7 kB view hashes)

Uploaded Source

Built Distribution

cereal_py-1.0-py3-none-any.whl (3.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page