You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make unimported utilities explicitely private #3099
Another proposal: if we have a lot of file-related private utilities, we can move them all to an _io.py file. Which can also anticipate a future public facing io.py file.
Apologies for butting in, but if LazyFile is being made private, is there a more appropriate type hint for parameters receiving lazily-opened files? In my own CLIs, I'm currently using it in that fashion, e.g.:
Okay, I see where my misunderstanding was; I had missed LazyFile.__getattr__ and thought lazy files needed to be explicitly .open()ed before use. Thanks for helping clear that up!
Activity
Rowlando13 commentedon Sep 30, 2025
@davidism
davidism commentedon Sep 30, 2025
Yes, and in the future I'd lean towards not exposing anything new to the top level (or public) without very deliberate consideration.
Rowlando13 commentedon Oct 1, 2025
I will also add private to the doc strings since they have no leading _.
kdeldycke commentedon Oct 8, 2025
Maybe we can even move them to the
_utils.pyfile.Rowlando13 commentedon Nov 22, 2025
I think we should rename them with leading _ and move into _utils if there is not a better spot for them.
kdeldycke commentedon Nov 23, 2025
Another proposal: if we have a lot of file-related private utilities, we can move them all to an
_io.pyfile. Which can also anticipate a future public facingio.pyfile.benblank commentedon Dec 15, 2025
Apologies for butting in, but if
LazyFileis being made private, is there a more appropriate type hint for parameters receiving lazily-opened files? In my own CLIs, I'm currently using it in that fashion, e.g.:It would suck to lose the ability to correctly type-hint
out_file, here. 🙂davidism commentedon Dec 15, 2025
It should not matter if the file is lazy or not, it has the same interface as a regular file.
benblank commentedon Dec 16, 2025
Okay, I see where my misunderstanding was; I had missed
LazyFile.__getattr__and thought lazy files needed to be explicitly.open()ed before use. Thanks for helping clear that up![-]Are unimported utilities intentional[/-][+]Make unimported utilities explicitely private[/+]