User manual

SNAPpy currently does not support the following common Python types, so they cannot be used in SNAPpy
scripts. They can sll be used in Python scripts running in Portal or a SNAP Connect applicaon.
float A oat is a floang-point number, with a decimal part.
long A long is an integer with arbitrary length (potenally exceeding the range of an int).
complex A complex is a number with an imaginary component.
list A list is an ordered collecon of elements.
dict A dict is an unordered collecon of pairs of keyed elements.
set A set is an unordered collecon of unique elements.
User-defined objects (class types)
Keywords
The following Python reserved idenfiers are supported in SNAPpy:
and
break
connue
def
elif
else
from
global
if
import
is
not
or
pass
print
return
while
The following idenfiers are reserved, but not yet supported in SNAPpy:
as
assert
class
del
except
exec
finally
for
in
lambda
raise
try
with
yield
Operators
SNAPpy supports all Python operators, with the excepon of floor (//) and power (**).
+ - * / %
<< >> & | ^ ~
< > <= >= == != <>
This extends to operators that assign a changed value to a variable.
x = 1
x += 4 # x now equals 5
y = "1"
y += "4" # y now equals "14"
Slicing
Slicing is supported for string and tuple data types. For example, if x is “ABCDE” then x[1:4] is “BCD”.
Concatenaon
Concatenaon is supported for string data types. For example, if x = “Hello” and y = “, world” then x + y is “Hello,
world”. String mulplicaon is not supported. You cannot use 3 * "Hello! " to get "Hello! Hello! Hello! " in
SNAPpy as you can in Python.
14 SNAP® Network Operang System