|
|
|
|
|
by xyrouter
3018 days ago
|
|
Like another commenter on this thread, I too find the second example the most readable and I write code like the second example even though I have many years of experience with Python. The third example is cool but I don't see the immediate value in writing code that way unless I am designing a framework of some kind. I am of the opinion that code should be written in as simple manner as possible so that programmers from different background can get up-to-speed with the code with little trouble. |
|
Checking for the types explicitly in your code creates a brittle system. For a one-off bit of code, fine. For anything that may be extended in the future, it's a bad idea and will have to be refactored to become maintainable.