Decorators for function annotations
Bug #609598 reported by
Dag Odenhall
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Six |
Won't Fix
|
Wishlist
|
Unassigned |
Bug Description
I propose the addition of decorators that mimic function annotations in 3.x. For example:
@overload_
@annotate(
def func(arg1, arg2): pass
>>> func.__
{'arg1': basestring, 'arg2': (int, long)}
@annotate(
@returns('greetings from the planet earth')
def func(a, b, c, some_kwarg): pass
>>> func.__
{'some_kwarg': 'hola!', 'return': 'greetings from the planet earth'}
The Python 3 versions would be:
@overload_
def func(arg1: str, arg2: int): pass
def func(a, b, c, some_kwarg: 'hola!') -> 'greetings from the planet earth': pass
Changed in python-six: | |
status: | New → Won't Fix |
To post a comment you must log in.
six is about provide wrappers around things that changed from 2->3, not backporting 3.x features. It seems like this would be easy to include in any project needing it.