[Python-ideas] Optional static typing -- the crossroads

Nick Coghlan ncoghlan at gmail.com
Sun Aug 17 10:50:08 CEST 2014


On 17 August 2014 18:34, Steven D'Aprano <steve at pearwood.info> wrote:
>
> Declaring types in the function parameter list is very common, in many
> languages. If it were *that* much harder to read, languages wouldn't
> keep using it. (Not many languages follow Forth or APL syntax.) Perhaps
> because I learned to program in Pascal, I find the annotation syntax
> very easy to read, but, yes, anything which increases the density of
> information per line risks hurting readability a little.

I once had the "pleasure" of inheriting some code written in K&R style
C, where the parameter type declarations were separate from the
signature line:

    void foo(a, b, c)
        double a;
        char b;
    {
          ...
    }

ANSI C, with inline typing,  is far more readable :)

When it comes to the readability of function headers with lots and
lots of parameters... I'm in the "those are inherently unreadable,
even if sometimes an unfortunate necessity" camp :)

Reorganising-the-subprocess-module-docs-was-interesting'ly,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-ideas mailing list