[Python-Dev] Type hints -- a mediocre programmer's reaction

Paul Sokolovsky pmiscml at gmail.com
Thu Apr 23 15:44:10 CEST 2015


Hello,

On Thu, 23 Apr 2015 14:48:58 +0200
Wolfgang Langner <tds333+pydev at gmail.com> wrote:

> Hello,
> 
> On Thu, Apr 23, 2015 at 11:59 AM, Paul Sokolovsky <pmiscml at gmail.com>
> wrote:
> 
> > Hello,
> >
> > On Thu, 23 Apr 2015 10:43:52 +0200
> > Wolfgang Langner <tds333+pydev at gmail.com> wrote:
> >
> > []
> >
> > > Also ask why no one used type specifier, they are possible since
> > > Python 3.0 ?
> > > Because it is the wrong way for Python.
> >
> > That's an example of how perceptions differ. In my list, everyone(*)
> > uses them - MyPy, MicroPython, etc. Even more should use them (any
> > JIT module, which are many), but sit in the bushes, waiting for a
> > kick, like PEP484 provides.
> >
> >
> > (*) Everyone of those who needs them. Otherwise, let's throw out
> > metaclasses - noone uses them.
> >
> >
> They are there to be used and won't go away.
> But for most Libraries out there no one used it.
> 
> JIT (Numba), Cython and other compilers/tools doing optimization have
> their own syntax and needs.

That's exactly what needs to change, and where this PEP helps, as was
already pointed out:
http://code.activestate.com/lists/python-dev/135659/

> They need even more information like i32, i64, different floats and
> so on. 

That's poor excuse for not trying to be a good member of Python
community (and work on standard type annotation syntax, instead of
digging own hole).

> MyPy is really new and in development. And the docstring type
> spec way is still possible.

Anything is possible. The talk is about what makes most of sense.
Docstrings were always arbitrary string designated at human's
consumption, how (ab)using them for type annotations is better than
having clean language-grammar syntax?

> MicroPython uses one annotation for their inline assembler stuff not
> type hints.

Here's how MicroPython uses type annotations:
https://github.com/micropython/micropython/blob/master/tests/micropython/viper_ptr8_load.py

> For the library there are no type hints for function definitions.
> 
> 
> Remark: I use Metaclasses, seldom but if needed very useful. :-)
> 
> 
> -- 
> bye by Wolfgang



-- 
Best regards,
 Paul                          mailto:pmiscml at gmail.com


More information about the Python-Dev mailing list