Message256746
| Author | serhiy.storchaka |
|---|---|
| Recipients | doerwalter, ezio.melotti, lemburg, martin.panter, serhiy.storchaka, vstinner |
| Date | 2015-12-19.23:50:07 |
| SpamBayes Score | -1.0 |
| Marked as misclassified | Yes |
| Message-id | <1450569007.85.0.886316721994.issue23231@psf.upfronthosting.co.za> |
| In-reply-to |
| Content | |
|---|---|
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 |
|
| History | |||
|---|---|---|---|
| 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: <1450569007.85.0.886316721994.issue23231@psf.upfronthosting.co.za> |
| 2015-12-19 23:50:07 | serhiy.storchaka | link | issue23231 messages |
| 2015-12-19 23:50:07 | serhiy.storchaka | create | |