FAQ
May I suggest to eliminate "->" in function definition?


      def function1 (variable1: variable1_type, variable2:
variable2_type): function1_type
          return str2function1_type(str(variable1)+str(' ')+str(variable2))


OR


      def function1: function1_type (variable1: variable1_type,
variable2: variable2_type):
          return str2function1_type(str(variable1)+str(' ')+str(variable2))


both look a bit simpler than


      def function1 (variable1: variable1_type, variable2:
variable2_type) -> function1_type:
          return str2function1_type(str(variable1)+str(' ')+str(variable2))


Are there any convincing reasons to introduce syntactic sugar?


Yours Mike Kozulya

Search Discussions

  • Benjamin Peterson at May 25, 2015 at 1:40 pm

    On Mon, May 25, 2015, at 04:02, Mike Kozulya wrote:
    May I suggest to eliminate "->" in function definition?

    def function1 (variable1: variable1_type, variable2:
    variable2_type): function1_type
    return str2function1_type(str(variable1)+str('
    ')+str(variable2))

    OR

    def function1: function1_type (variable1: variable1_type,
    variable2: variable2_type):
    return str2function1_type(str(variable1)+str('
    ')+str(variable2))

    both look a bit simpler than

    def function1 (variable1: variable1_type, variable2:
    variable2_type) -> function1_type:
    return str2function1_type(str(variable1)+str('
    ')+str(variable2))

    Are there any convincing reasons to introduce syntactic sugar?

    That's simply preexisting function annotation syntax.
    https://www.python.org/dev/peps/pep-3107/


    It's not invented by the type hinting pep.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-dev @
categoriespython
postedMay 25, '15 at 8:02a
activeMay 25, '15 at 1:40p
posts2
users2
websitepython.org

2 users in discussion

Benjamin Peterson: 1 post Mike Kozulya: 1 post

People

Translate

site design / logo © 2017 Grokbase