Which THREE of the following are true regarding the use of 'threading' and 'requests' in Python?
Threads within one process share the same heap and global interpreter state, so concurrent requests code can read and mutate common objects directly. This shared memory is precisely why synchronisation primitives such as locks are needed to avoid race conditions.
Why this answer
Option A is correct because threads within a single Python process share the same memory space, which allows them to access shared objects and data directly (though this requires synchronization primitives like locks to avoid race conditions). Option C is correct because creating a requests.Session object per thread is a best practice: a Session provides connection pooling and cookie persistence, and since Session objects are not thread-safe, each thread should have its own instance to avoid cross-thread interference. Option E is correct because threading is well suited for I/O-bound tasks such as API calls with the requests library, since threads release the GIL during blocking I/O operations, allowing other threads to run concurrently.
Option B is incorrect because requests is inherently I/O-bound (network operations), not CPU-bound. Option D is incorrect because threads do not bypass the GIL entirely; the GIL still serializes bytecode execution, and threads only release it during I/O or explicit C-level calls.