PrintingΒΆ
SNAPpy also supports a print
statement:
print("line 1")
print("line 2")
print("value of x is ", x, " and y is ", y)
Printing multiple elements on a single line in SNAPpy produces a slightly different output from how the output appears when printed from Python. Python inserts a space between elements, where SNAPpy does not.
SNAPpy also imposes some restrictions on the printing of nested tuples. You may nest tuples; however, printing of nested tuples will be limited to three layers deep. The following tuple:
(1,'A',(2,'b',(3,'Gamma',(4,'Ansuz'))))
will print as:
(1,'A',(2,'b',(3,'Gamma',(...
SNAPpy also handles string representations of tuples in a slightly different way from Python. Python inserts a space after the comma between items in a tuple, while SNAPpy does not pad with spaces, in order to make better use of its limited string-processing space.