User manual

Variables do have types, but they can change on the fly
x = 99 # variable x is currently an integer (int)
x = False # variable x is now a Boolean value of False
x = "hello" # variable x is now a string (str)
x = (x == "hello") # variable x is now a Boolean value of True
Funcons can change, too
If you have two funcon definions that define funcons with the same name, even with different parameter
signatures, only the second funcon will be available. You cannot overload funcon names in SNAPpy based on
the number or type of parameters expected.
You can use a special type of comment called a “docstring”
At the top of a script, and aer the beginning of any funcon definion, you can put a specially formaed string
to provide inline documentaon about that script or funcon. These special strings are called “docstrings.
“Docstrings” should be delimited with three single quote characters (') or three double quote (") characters.
(Use double quotes if your string will span more than one line.) Here are some examples:
"""
This could be the docstring at the top of a source file, explaining
what the purpose of the file is
"""
def printHello():
"""this function prints a short greeting"""
print "hello"
These “docstrings” will appear as tool-ps in some porons of the Portal GUI. They are also considered a good
pracce in Python programming.
12 SNAP® Network Operang System