ELIFE-ASU / PyInform

A Python Wrapper for the Inform Information Analysis Library
https://elife-asu.github.io/PyInform
MIT License
45 stars 9 forks source link

Stubout an example distribution class #1

Closed dglmoore closed 8 years ago

dglmoore commented 8 years ago

The objective of this class it to encapsulate the memory (de)allocation that is often necessary when dealing with C structures. Here we wrap up the inform_dist structure in a class called Dist. The allocation of the inform_dist object is mad within the Dist.__cinit__ constructor, and deallocation is made via the Dist.__dealloc__ method. Both of these methods are called implicitly, so no care is required on the end user's part.

As a quick testing method we create the Dist.__len__ method which lets use call the len function on distributions, returning the size of the distribution's support.

Tests are included.

A couple of things that might be interesting in the coming commits: