AndreaCensi / contracts

PyContracts is a Python package that allows to declare constraints on function parameters and return values. Contracts can be specified using Python3 annotations, or inside a docstring. PyContracts supports a basic type system, variables binding, arithmetic constraints, and has several specialized contracts and an extension API.
http://andreacensi.github.io/contracts/
Other
398 stars 62 forks source link

Add numpy 'object' data type contract #71

Open ddasilva opened 5 years ago

ddasilva commented 5 years ago

First of all, I want to thank you for this project. This is really great work and design. I'm using it to develop satellite data processing pipelines at NASA Goddard.

Currently, using 'object' as a data type is not supported. A NumPy array with a datatype 'object' holds references to Python objects. Sometimes, it is useful to have a numpy array of object: unlike a list, a numpy object array can support multiple dimensions and advanced slicing.

This is a feature request to add the 'object' datatype to the contract specification for numpy arrays.

Reference: https://andreacensi.github.io/contracts/reference.html#numpy-specific-contracts