Closed rwarren closed 6 years ago
Zstd.Error
can be used. As do zlib
:
>>> import zlib
>>> zlib.compress("123", 22)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
zlib.error: Bad compression level
The Zstandard implementation uses -1 through -22
Nope. Zstd uses 1 through 22 levels, and ultra-fast levels -1..-5 (--fast param). But in console tool -1..-22 is the tool param.
@rwarren Can you look into #28 pull? Is it ok to you?
PR #28 looks great to me. Good API, good docs, and good comments. The clarity on compression levels (fastest and slowest) is great, as is the addition of the ultra-fast levels documentation when compiled in.
I only have two minor suggestions:
Raises an zstd.Error exception if any error occurs
to Raises zstd.Error on any error
, or Raises a zstd.Error exception if any error occurs
.
@rwarren Got it. Updated pull request.
@rwarren Any other suggestions?
@sergey-dryabzhinsky Sorry - I thought I'd responded earlier, but apparently not! I did review your changes when you made them and they looked good to me.
i.e. I've got no more suggestions. :)
Ok. Merged.
The docstring for
zstd.compress
is currently:This has a few issues:
string
andlevel
)level
level
values will be handledFor comparison, here is the
zlib.compress
docstring:Following this lead, I suggest a
zstd.compress
docstring like this:I also want to add a few comments to that suggested docstring...
-5
. Why is this?ValueError
, rather than silently clipping.ValueError
would have immediately clarified when I invoked incorrectly.ZSTD_MAX_CLEVEL
andZSTD_MIN_CLEVEL
as "write-less-code-later insurance" against this range every getting expandedValueError
were raised, the clipping statement in the suggested docstring could just be removed.