Home | Trees | Indices | Help |
|
---|
|
object --+ | utils.graph.DetailNode --+ | any_type.AnyType --+ | simple_type.SimpleType --+ | object --+ | | | utils.graph.DetailNode --+ | | | any_type.AnyType --+ | | | BinaryType --+ | BinarySimpleType --+ | object --+ | | | editable.EditableBase --+ | | | editable.EditableLineEdit --+ | FixedString
String of fixed length. Default length is 0, so you must override this class and set the _len class variable.
>>> from tempfile import TemporaryFile >>> f = TemporaryFile() >>> class String8(FixedString): ... _len = 8 >>> s = String8() >>> if f.write('abcdefghij'.encode()): pass # ignore result for py3k >>> if f.seek(0): pass # ignore result for py3k >>> s.read(f) >>> str(s) 'abcdefgh' >>> if f.seek(0): pass # ignore result for py3k >>> s.value = 'Hi There' >>> s.write(f) >>> if f.seek(0): pass # ignore result for py3k >>> m = String8() >>> m.read(f) >>> str(m) 'Hi There'
|
|||
Inherited from |
|
|||
|
|||
str |
|
||
C{bytes} |
|
||
|
|||
|
|||
|
|||
|
|||
Inherited from Inherited from Inherited from Inherited from Inherited from |
|
|||
_len = 0
|
|||
Inherited from |
|
|||
value A property which wraps the actual data. |
|||
Inherited from |
|
|
|
|
|
|
|
|
|
valueA property which wraps the actual data. This property always calls set_value to assign the value, and ensures that the value is valid (type, range, ...). Unless you know what you are doing, always use the value property to change the data.
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Mon Oct 10 19:03:56 2011 | http://epydoc.sourceforge.net |