Manan
1 min readJan 13, 2019

--

I agree with almost everything you wrote but I take some issue with the “try not to rely on types” tip. Python is dynamically typed — chances of using something that is supposed to be something else are high with that. In fact, that’s why Python started supporting `type hints` starting from version 3.5

You can now write code like this —

def add(x: int, y: int) -> int:
return x + y

Arguably, it’s less cleaner than a simple —

def add(x, y):
return x + y

But it does provide some internal checking.

If you were to provide arguments with different types in PyCharm now, it’d raise a warning in the IDE. So it’s not inherently bad to have some sort of type checking of your own.

--

--

Manan
Manan

Written by Manan

Computer Science and Mathematics enthusiast. I dabble in Philosophy.

No responses yet