About -> in Python Functions [Duplicate]

Asked 2 years ago, Updated 2 years ago, 16 views

(One answer) 6 years ago

Python's function had the following description.

def hoge(string)->str:
    return string

I'd like to find out what this "->" means in such a function.
I'm having a hard time searching because it was a symbol.
If you know what this operator means, please let me know.
I look forward to your kind cooperation.Excuse me.

python

2022-09-29 22:28

1 Answers

Annotation of the function.In this example, the return value of the function is a string type.

http://docs.python.jp/3.3/tutorial/controlflow.html#function-annotations
http://docs.python.jp/3.3/reference/compound_stmts.html#function


2022-09-29 22:28

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.