Hacker News new | ask | show | jobs
by aldanor 1992 days ago
Why the JS-like naming, weird method naming convetions with strange underscores, and capitalized module name? I can't remember a single commonly used Python library with naming this strange.

E.g.

    def removeByIndex(self, b):
        """ Removes the value at specified index or indices. """
        ...

    def removeByIndex_(self, b):
        """ Removes the value at specified index or indices in-place. """
        ...
If you were to follow typical naming conventions, these would be either

    def remove_by_index(self, b): ...
    def remove_by_index_inplace(self, b): ...
Or pandas-like:

    def remove_by_index(self, b, inplace=False): ...
Or, one more step, use explicit typing as well (which also makes it more clear that the method returns self), and give a better name to the method argument rather than 'b':

    def remove_by_index(
        self, 
        index: Union[int, Iterable[int]], 
        inplace: bool = False,
    ) -> 'Array': ...
Explicit type signatures in libraries like this make many things self-explanatory, like the one above.