Passing data between multiprocessing processes
suggest changeBecause data shared between two threads is sensitive (concurrent reads and writes can conflict and cause race conditions), unique objects were added to pass data back and forth between threads. Any truly atomic operation can be used between threads, but it is always safe to stick with Queue.
Most people suggest that, when using Queue, you always place the queue operation in a try/except block instead of using empty. For applications where it does not matter if you skip a scan cycle (data can be placed on the queue while it flips from empty to not empty), it is usually better to place read and write access in what I call an Iftry block, because an if statement is technically more performant than catching the exception.
The heading is about processes. The notes above discuss threads. multiprocessing has its own Queue, and checking empty before get has the same race. This page has no sample.