Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/source/cheat_sheet.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Built-in types
# For simple built-in types, just use the name of the type.
x = 1 # type: int
x = 1.0 # type: float
x = True # type: bool
x = "test" # type: str
x = u"test" # type: unicode

Expand Down Expand Up @@ -61,6 +62,11 @@ Functions
"""Your function docstring goes here after the type definition."""
return str(num)

# This function has no parameters and also returns nothing. Annotations
# can also be placed on the same line as their function headers.
def greet_world(): # type: () -> None
print "Hello, world!"

# And here's how you specify multiple arguments.
def plus(num1, num2):
# type: (int, int) -> int
Expand Down