From 7e35af53c5440aec2a767837d9059a0e5f44ee00 Mon Sep 17 00:00:00 2001 From: Kevin Yap Date: Thu, 13 Oct 2016 22:35:14 -0700 Subject: [PATCH] Add additional information to syntax cheat sheet --- docs/source/cheat_sheet.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/source/cheat_sheet.rst b/docs/source/cheat_sheet.rst index 24ecb0a924d8..cf36dcae4fd1 100644 --- a/docs/source/cheat_sheet.rst +++ b/docs/source/cheat_sheet.rst @@ -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 @@ -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