Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New array creator #17

Closed
astropenguin opened this issue Apr 10, 2020 · 0 comments
Closed

New array creator #17

astropenguin opened this issue Apr 10, 2020 · 0 comments

Comments

@astropenguin
Copy link
Member

Make a new class-based array creator.

class ArrayCreator:
    def __init__(specs):
        self.specs = specs

    def __call__(self, array):
        return self.create(array)

    def ones(self, shape):
        return self(np.ones(shape))

    def zeros(self, shape):
        return self(np.zeros(shape))

series = ArrayCreator(series_specs)
map = ArrayCreator(map_specs)

A data array can be created like the following codes.

array_1 = series([[1, 2], [3, 4]])
array_2 = series.ones([10, 10])
astropenguin added a commit that referenced this issue Apr 17, 2020
astropenguin added a commit that referenced this issue Apr 17, 2020
astropenguin added a commit that referenced this issue May 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant