Skip to content

futurize script should preserve function annotations with compatible syntax #3

Open

Description

@edschofield

Spawned from issue #2.

Running futurize --from3 should convert Python 3 function annotations such as::

def _parse(self, filename: str, dir='.') -> list:
    ...

into the following Python 3 / Python 2 compatible code:

def _parse(self, filename, dir='.'):
    ...
_parse.__annotations__ = {'filename': str, 'return': list}

Activity

  1. Uzume commented on Dec 14, 2017

    @Uzume

    It would probably make sense to use function decorators to accomplish this, e.g.,

    @func_annotations(list)
    def _parse(self, filename, dir='.'):
        ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions