Python is DOOMED! Again!

Steven D'Aprano steve+comp.lang.python at
Fri Jan 23 05:51:28 CET 2015

Sturla Molden wrote:

> Chris Angelico <rosuav at> wrote:
>> Uhh... if your managers and customers are stipulating non-Pythonic
>> coding styles, then it's time to find new managers/customers. If
>> they're not writing the code, code quality shouldn't be their concern.
> I am saying the day someone requires me to write a type hint, I will no
> longer be using Python or recommending it. Python is great, but not that
> great.

You probably already write type checks, only you might do it like this:

def my_func(x, index=0):
    if not isinstance(index, int):
        raise TypeError("index must be an integer")

or perhaps like this:

def my_func(x, index=0):
        if index == int(index):
    except TypeError:
        raise TypeError("index must be an integer, not a float")

And then you write tests to confirm that my_func fails correctly when given
an index which is not an integer. Most of that is monkey-work, so simple
that even the compiler can do it.

How about writing this instead?

def my_func(x, index:int=0): 

Is that really such an unspeakable burden? *Always* a burden? You cannot
imagine any circumstances where you would gain some advantage by having an
automated type-checker identify type-related bugs?

Well okay then. Keep working the way you do right now.


More information about the Python-list mailing list