
On Thu, Sep 01, 2022 at 03:11:29PM -0700, Bruce Leban wrote:
* a stream-like object that has been closed and you attempt to read from or write data to it.
That would be a ValueError:
f.write('a') Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: I/O operation on closed file.
Its arguable that this could (should?) have been some sort of IOError instead, but that ship has sailed.
* a random number generator that has not been initialized with a seed (in the case where you have a constructor which doesn't also initialize it).
That would be a bug in the constructor.
* a hash function which you try to compute the digest without having added any data to it.
That shouldn't be an error at all:
a = hashlib.sha256() a.hexdigest() 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
-- Steve