r/Python • • Jan 05 '18

Really??

Post image
2.0k Upvotes

317 comments sorted by

View all comments

Show parent comments

5

u/TravisJungroth Jan 06 '18

I'm a huge Python nut and I basically agree. The biggest problem for me is the loss of meaning. Trying to read through a code flow in a sufficiently large code base with a dynamically typed language is a nightmare.

I do believe type hinting will help a ton, though I'm not sure it will be enough. I now write type hints into everything. I don't care if it's a single function. Having my IDE hint properly is worth it.

4

u/scootstah Jan 06 '18

Trying to read through a code flow in a sufficiently large code base with a dynamically typed language is a nightmare

Honestly, that just sounds like a badly designed application. I doubt adding strict type will make any difference to its legibility.

7

u/TravisJungroth Jan 06 '18
def func(obj):
    obj.method()

What does method() do? What other methods are available on obj? Without some sort of type enforcement, you don't have a clue without looking at the usage of func. This is fine when it's only used three times, but terrible when it's used a hundred times.

5

u/constantly-sick Jan 06 '18

Name method() better. Try x_to_y_process().