Skip to content

Type comments should be supported #7

@smarie

Description

@smarie

According to PEP484 one can declare type hints using a "comments" format.

It would be good that create_function supports this way of defining the type hints:

func_signature = """
foo(b,      # type: int
    a = 0,  # type: float
    ):
    # type: (...) -> str
"""

def dummy_handler(*args, **kwargs):
    return "hello"

dynamic_fun = create_function(func_signature, dummy_handler)

assert dynamic_fun.__annotations__ == {'a': float, 'b': int, 'return': str}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions