pyfastx icon indicating copy to clipboard operation
pyfastx copied to clipboard

How to safely close file handles with Fastx?

Open bjpop opened this issue 3 years ago • 3 comments

It is not clear how to safely close any file handles that are opened by Fastx (or any of the other classes provided by this library).

It would be nice to be able to use Fastx with contextlib for example.

bjpop avatar Dec 23 '20 03:12 bjpop

You don't have to worry about the opened file handle. Before Fastx object is destroyed, the opened file handle will automatically be closed by pyfastx.

lmdu avatar Dec 23 '20 04:12 lmdu

Fair enough, although sometimes it is useful to be able to close the file handle before waiting for GC to remove the object.

Perhaps this detail can be added to the docs?

bjpop avatar Dec 23 '20 04:12 bjpop

Ok, I will do that. Thank you!

lmdu avatar Dec 23 '20 05:12 lmdu