# zlib.Decompress should have an attribute to tell if output is available

**URL:** <https://discuss.python.org/t/zlib-decompress-should-have-an-attribute-to-tell-if-output-is-available/106898>\
**Category:** Ideas\
**Created:** [April 8, 2026, 1:33pm UTC](https://discuss.python.org/t/zlib-decompress-should-have-an-attribute-to-tell-if-output-is-available/106898 "2026-04-08T13:33:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dreamsorcerer](https://avatars.discourse-cdn.com/v4/letter/d/779978/32.png) [@dreamsorcerer](https://discuss.python.org/u/dreamsorcerer)\
**Post date:** [April 8, 2026, 1:33pm UTC](https://discuss.python.org/t/zlib-decompress-should-have-an-attribute-to-tell-if-output-is-available/106898/1 "2026-04-08T13:33:58Z")

</div>

The current API when using `max_length` feels inadequate, as there is no way to know if there is more data available to decompress or not. Users must make a redundant call to .decompress() and receive `b""` to know that all pending data has been decompressed.

My suggestion would be to have a simple `.data_available` attribute that represents this. Or, to match the zstd API, a `.needs_input` attribute could be added, in which case a user can check `not d.needs_input and not d.eof`.
