indygreg / indygreg/python-zstandard
The open API is inconsistent
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 642
- Forks
- 116
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 5
Description
Iterating over text data works as expected:
In [2]: for line in zstandard.open('123.zst', 'rt'):
...: print(line)
...:
123
Iterating over binary data raises an exception:
In [4]: for line in zstandard.open('123.zst', 'rb'):
...: print(line)
...:
---------------------------------------------------------------------------
UnsupportedOperation Traceback (most recent call last)
<ipython-input-4-42009a852259> in <module>
----> 1 for line in zstandard.open('123.zst', 'rb'):
2 print(line)
UnsupportedOperation:
I think it makes sense to wrap binary reader/writer in io.BufferedReader/io.BufferedWriter.
Most libraries provide the same interface for text and binary streams.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the zstandard.open entry point and compare how its text and binary readers handle iteration. Check the binary reader and writer behavior against io.BufferedReader and io.BufferedWriter; done means binary streams support iteration without UnsupportedOperation while preserving the existing text behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100