You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In IPC.py, we define a couple of classes to represent FIFOs.
In particular, we implement a FIFO for Unix systems and another one for Windows systems.
Then, the file ends with a global if statement that defines FIFO to be the appropriate class for the given operating system.
This is a bit flaky.
Instead, we could look at how pathlib (from the standard library) implements Path, which dynamically figures out the OS it's in.
(Plot twist: this is done through the dunder method __new__.)
In doing this, we should figure out what exactly is the protocol that we need from the FIFOs, so that we can implement that protocol for the two types of systems.
When this is done properly, there will be no need to keep differentiating from the two types of FIFOs in the remainder of the code.
The text was updated successfully, but these errors were encountered:
In
IPC.py
, we define a couple of classes to represent FIFOs.In particular, we implement a FIFO for Unix systems and another one for Windows systems.
Then, the file ends with a global
if
statement that definesFIFO
to be the appropriate class for the given operating system.This is a bit flaky.
Instead, we could look at how
pathlib
(from the standard library) implementsPath
, which dynamically figures out the OS it's in.(Plot twist: this is done through the dunder method
__new__
.)In doing this, we should figure out what exactly is the protocol that we need from the FIFOs, so that we can implement that protocol for the two types of systems.
When this is done properly, there will be no need to keep differentiating from the two types of FIFOs in the remainder of the code.
The text was updated successfully, but these errors were encountered: