when used to create a function. how def ...">

Python & # 8594; "operator" to define functions

I really don’t understand what the operator does ->when used to create a function.

how

def create(self) -> None:
    raise NotImplementedError("It should be implemented specifically for your backend")

or

@property
def to(self) -> Identifier:
    return self._to

I tried the search, but I don’t know what is called by the “operator” or is its operator at all, but when used ->in the search it does not work :(

+4
source share
1 answer

You are viewing feature annotations. They do not apply to objects property. Annotations allow you to attach arbitrary information to a function; the part -> [expression]gives information about the return value of the function. Syntax was added in Python 3.0.

Python 3.5 , .

Python , funcdef ->, " " :

": expression" . , *identifier **identifier. "" "-> expression". Python .

. PEP 3107 - PEP 484 - , .

+6

All Articles