|
|
- String
class
String |
|
Make sure objects get string representation usable by
adesklets interpreter. This class simply flattened recursively
all sequences passed to it, while preserving all other objects
but 'None', which is stripped-out and booleans which is transformed
to '0' or '1'.
Of course, this does not dispense you from having terminal types
with __str__ methods.
For instance, str(String([1,None,('essai',True),4])) is '1 essai 1 4'
Limitation: any large (>=1204 elements) sequences containing booleans
or undefined objects will contain 'True' 'False' or 'None' substrings
in the final result, and will therefore not be usable by adesklets.
Now, this is not really a concern since such large entries are not used
for any adesklets commands with anything but arrays of integers.
Read below for further explanations on this.
It should also be noted that the performance tune up possible on linux
using mmap for large sequences is presently not working on all BSD's,
so it is turned off by default; if anyone knows freebsd, openbsd or netbsd
well enough to give me advice on this, I will be glad to change this code.
|
|
Methods defined here:
- __del__(self)
- __init__(self,
object)
- __str__(self)
|
|