Skip to main content

Implementation of the Observer pattern for NumPy arrays

Project description

ndarray-listener

Implementation of the Observer pattern for NumPy arrays.

Example

from numpy import array
from ndarray_listener import ndl

a = ndl(array([-0.5, 0.1, 1.1]))

class Observer(object):
  def __init__(self):
    self.called_me = False

  def __call__(self, _):
    self.called_me = True

o = Observer()
a.talk_to(o)
print(o.called_me)
a[0] = 1.2
print(o.called_me)

The output should be

False
True

Install

From command line, enter

pip install ndarray-listener

Running the tests

Install dependencies

pip install pytest

then run

python -c "import ndarray_listener; ndarray_listener.test()"

Documentation

Documentation

Authors

License

This project is licensed under the MIT License.

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

ndarray_listener-2.0.2.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ndarray_listener-2.0.2-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file ndarray_listener-2.0.2.tar.gz.

File metadata

  • Download URL: ndarray_listener-2.0.2.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for ndarray_listener-2.0.2.tar.gz
Algorithm Hash digest
SHA256 46fefc573b1b8f681502649beb349771de67a114a17f4b9c48836d8fba18a936
MD5 de83dbb9219b37890d711e40aed974f3
BLAKE2b-256 345f246873b4d6d92453fe949e9914a5a0ad85cf72ecd50e9d11ad13956d7146

See more details on using hashes here.

Provenance

The following attestation bundles were made for ndarray_listener-2.0.2.tar.gz:

Publisher: release.yml on limix/ndarray-listener

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ndarray_listener-2.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for ndarray_listener-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6f963fdb36abd87334cf7eff299c10396064ac82e4f2ff41d8b23bc0e1ce2805
MD5 09c31d3242272773f02784c74d4679b7
BLAKE2b-256 91cf70e70b7d5deab6bfbc8d667d316fb6b757d9fd38739f96b475b728858b80

See more details on using hashes here.

Provenance

The following attestation bundles were made for ndarray_listener-2.0.2-py3-none-any.whl:

Publisher: release.yml on limix/ndarray-listener

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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