2018-07-12 | Paul Boddie | file changeset files shortlog | Support trailing data after attributes in objects, employed by float instances to store their double-precision numeric data which needs more space than single attributes on some systems. In order to initialise such instances statically, specific object types must be indicated instead of the generic __obj type. This then requires casting to __ref of direct references to objects. Added an underflow error. Added initial testing of floating point numbers. | trailing-data |
paul@295 | 1 | l = range(0, 10) |
paul@295 | 2 | print l # [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] |
paul@295 | 3 | |
paul@295 | 4 | s = slice(2, 5) |
paul@295 | 5 | print s # __builtins__.span.slice(2, 5, 1) |
paul@295 | 6 | |
paul@295 | 7 | print l[s] # [2, 3, 4] |
paul@295 | 8 | print l[2:5] # [2, 3, 4] |
paul@295 | 9 | print l[2:5:-1] # [] |
paul@295 | 10 | print l[5:2:-1] # [5, 4, 3] |
paul@295 | 11 | print l[1:9:2] # [1, 3, 5, 7] |
paul@295 | 12 | print l[9:1:-2] # [9, 7, 5, 3] |
paul@367 | 13 | print l[::-1] # [9, 8, 7, 6, 5, 4, 3, 2, 1, 0] |
paul@370 | 14 | print l[::-2] # [9, 7, 5, 3, 1] |
paul@370 | 15 | print reversed(l) # [9, 8, 7, 6, 5, 4, 3, 2, 1, 0] |