+0.1? > The code I'm currently working on involves parsing binary data. If I > ask for, say, 4 bytes, it's because I actually need 4 bytes and if the > file doesn't have 4 bytes for me, it's malformed. Because `f.read(4)` > can silently return less than 4 bytes and I don't want to have to > explicitly double check every read, I'm using a wrapper function.
Without taking a position on whether this is worth it in the standard library, it should be noted that Rust's stdlib does include a read_exact function working in much the same way (though of course with a Result<T> instead of an exception, and it should be noted that Rust, as a systems language, is far more likely to be used to parse binary formats). -- Lincoln Auster They/Them _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/SCKHQHJEZXDKPBVEXOA2HXU74FEQ3M2O/ Code of Conduct: http://python.org/psf/codeofconduct/