[Python-ideas] Better Type Hinting

Andrew Barnert abarnert at yahoo.com
Fri Jun 5 08:01:14 CEST 2015


On Jun 4, 2015, at 22:36, Thomas Güttler <guettliml at thomas-guettler.de> wrote:
> 
> It would be great to have better type hinting in IDEs.

Is PEP 484 not sufficient for this purpose?

Of course you'll have to wait until 3.5 or use an external backport (I think the goal is for MyPy to include stub files for 2.7/3.3/3.4, and/or for them to be published separately on PyPI?), and even longer for every library you depend on to get on board. And of course your favorite IDE has to actually do something with these type hints, and integrate an inference engine (whether that means running something like MyPy in the background or implementing something themselves). But I don't think there's anything Python itself can do to speed any of that up.

And meanwhile, I suppose it's possible that the PEP 484 design will turn out to be insufficient, but there's no way we're going to know that until the IDEs try to use it and fail.

> My usecase:
> 
> logger = logging.getLogger(__name__)
> try:
>    ...
> except FooException, exc:
>    logger.warn('...')

Is there a reason you're using syntax that's deprecate since Python 2.6 and doesn't work in 3.x? Any proposal for the future of the Python language isn't going to help you if you're still using 2.5.



More information about the Python-ideas mailing list