Message256746
The patch changes public interface. This breaks compatibility with third-party codecs implementing it.
We have found other solution to iterencode/iterdecode problem. For example we can buffer iterated values and encode with one step delay:
prev = sentinel = object()
for input in iterator:
if prev is not sentinel:
output = encoder.encode(prev)
if output:
yield output
prev = input
if prev is not sentinel:
output = encoder.encode(prev, True)
if output:
yield output
Or remember the previous value and use it to calculate the empty value at the end (works only if input type supports slicing):
prev = sentinel = object()
for input in iterator:
output = encoder.encode(input)
if output:
yield output
prev = input
if prev is not sentinel:
output = encoder.encode(prev[:0], True)
if output:
yield output |
|
| Date |
User |
Action |
Args |
| 2015-12-19 23:50:07 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, lemburg, doerwalter, vstinner, ezio.melotti, martin.panter |
| 2015-12-19 23:50:07 | serhiy.storchaka | set | messageid: <[email protected]> |
| 2015-12-19 23:50:07 | serhiy.storchaka | link | issue23231 messages |
| 2015-12-19 23:50:07 | serhiy.storchaka | create | |
|