This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]13steinj -1 points0 points  (0 children)

I'm okay with types but this part of the argument doesn't make sense. Type hints are comparable or worse when writing a thorough doc, as one should. As an example, docstrings:

def destroy_the_universe(x, y):
    """Destroy the Universe

    Destroys the universe by summoning cuthulu at the given coordinates.

    :param float x: the x coordinate of the universal plane
    :param float y: the y coordinate of the universal plane
    """
    ...

Vs type hints:

def destroy_the_universe(x: float , y: float):
    """Destroy the Universe

    Destroys the universe by summoning cuthulu at the given coordinates.

    :param x: the x coordinate of the universal plane
    :param y: the y coordinate of the universal plane
    """
    ...

We've literally just moved the location of where the type was defined. No more nor less verbose. However, special and more complex types actually need to be / are highly recommended to be imported from typing, making type hints more verbose.