inaos / iron-array

2 stars 0 forks source link

Make params of IArray methods more consistent #584

Closed FrancescAlted closed 2 years ago

FrancescAlted commented 2 years ago

Right now, the params in IArray methods have a signature like this:

def max(self, axis=None, **kwargs):

However, the docstring refers to inexistent 'a' array and 'cfg'. This should be fixed.

Also, it would be nice to annotate the arguments, like:

def max(axis: Union[int, tuple] = None, cfg: ia.Config = None, **kwargs)

Regarding the inexistent 'a', this is equivalent to 'self' in methods, so I propose to document it like this:

       a (or self) : :ref:`IArray`
            Input data.

Also, for handling the new 'cfg' argument, I propose to use something like:

cfg == self.cfg if cfg is None else cfg

at the beginning of each method.

Finally, I'd add a note in the 'Return' section of the docstring like:

""" Note: In case this is called as a method, a LazyExpr subexpression object is returned. This is meant to be part of lazy expressions. """

martaiborra commented 2 years ago

Done in https://github.com/inaos/iron-array-python/commit/fc4e73e3971b12d4d819cd4aea2738e1112ba778.