[Python-ideas] PEP 484 (Type Hints) -- first draft round

Fetchinson . fetchinson at googlemail.com
Fri Jan 23 14:33:25 CET 2015


It looks like type hinting as a feature is applauded by everyone but
the actual syntax/implementation is polarizing. Could we have a
section in the PEP listing all alternative sytax/implementations with
pros and cons? Stuff like:

1. Stub files


2. property-style type hinting, e.g.:

    @typehints( arg1: int, arg2: str, returns: str )
    def func( arg1, arg2 )
        return 'hello'


3. docstrings, e.g.:

    def func( arg1, arg2 ):
        """type hints: arg1: int, arg2: str, returns: str"""
        return 'hello'

4. Cobra-inspired type hints, e.g.:

    def func( arg1, arg2 ):
        requires:
            isinstance( arg1, int )
            isinstance( arg2, str )
        returns:
            str


Cheers,
Daniel



-- 
Psss, psss, put it down! - http://www.cafepress.com/putitdown


More information about the Python-ideas mailing list