Lichen

Annotated tests/buffer.py

934:2989aab1b4f7
2021-06-29 Paul Boddie Renamed the utf8string class to unicode, eliminating the unicode function. This means that the simple case of merely returning an object if it is already a Unicode object no longer occurs when using the unicode callable, but such behaviour might be better supported with more general customised instantiation functionality.
paul@220 1
b = buffer()
paul@220 2
b.append("Hello")
paul@220 3
b.append(" ")
paul@220 4
b.append("world")
paul@220 5
b.append("!")
paul@259 6
print b                 # Hello world!
paul@220 7
paul@220 8
b = buffer(["Hello "])
paul@259 9
print repr(b)           # buffer(["Hello "])
paul@259 10
paul@220 11
b2 = buffer(["world!"])
paul@220 12
b.append(b2)
paul@259 13
print b                 # Hello world!