Specifications

The usual Boolean functions are supported
Symbol Meaning
and Both must be True
or Either can be True
not Boolean inversion (not True == False)
Result = True and True # Result is True
Result = True and False # Result is False
Result = False and True # Result is False
Result = False and False # Result is False
Result = True or True # Result is True
Result = True or False # Result is True
Result = False or True # Result is True
Result = False or False # Result is False
Variables do have types, but they can change on the fly
x = 99 # variable x is currently an integer (int)
x = "hello" # variable x is now a string (str)
x = True # variable x is now a Boolean (bool)
Functions can change, too
If you have two function definitions that define functions with the same name, even with different
parameter signatures, only the second function will be available. You cannot overload function 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 after the beginning of any function definition, you can put a specially
formatted string to provide inline documentation about that script or function. 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-tips in some portions of the Portal GUI.
SNAP Reference Manual Document Number 600-0007K Page 21 of 202