User manual
SNAPpy currently does not support the following common Python types, so they cannot be used in SNAPpy
scripts. They can sll be used in Python scripts running in Portal or a SNAP Connect applicaon.
• float – A float is a floang-point number, with a decimal part.
• long – A long is an integer with arbitrary length (potenally exceeding the range of an int).
• complex – A complex is a number with an imaginary component.
• list – A list is an ordered collecon of elements.
• dict – A dict is an unordered collecon of pairs of keyed elements.
• set – A set is an unordered collecon of unique elements.
• User-defined objects (class types)
Keywords
The following Python reserved idenfiers are supported in SNAPpy:
• and
• break
• connue
• def
• elif
• else
• from
• global
• if
• import
• is
• not
•
or
•
pass
•
print
•
return
•
while
The following idenfiers 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 excepon 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”.
Concatenaon
Concatenaon is supported for string data types. For example, if x = “Hello” and y = “, world” then x + y is “Hello,
world”. String mulplicaon is not supported. You cannot use 3 * "Hello! " to get "Hello! Hello! Hello! " in
SNAPpy as you can in Python.
14 SNAP® Network Operang System