rec / safer

🧷 A safer writer 🧷
https://rec.github.io/safer/
MIT License
174 stars 9 forks source link

In-memory buffering #5

Closed rec closed 4 years ago

rec commented 4 years ago

https://www.reddit.com/r/programming/comments/g474ig/safer_a_safer_file_writer_for_python/fnwwbko/

rec commented 4 years ago

This is challenging though not impossible.

I did quite a bit of the work here: https://github.com/rec/safer/blob/x-in-memory/safer.py#L164-L258

But then I realized that the whole point of this is things like streams from sockets, where safer isn't going to either close or open them.

So I need to split out a context manager somehow.

More thought is needed.

rec commented 4 years ago

More thought was given. It is done and in fact is now the default.