singleton ... again
In article <mailman.6850.1392313443.18130.python-list at python.org>,
Ethan Furman <ethan at stoneleaf.us> wrote:
> Say you have a class that represents serial ports or your computer. You
> should get the same object every time you ask
> for SerialPort(2).
Why? Certainly, you should get objects which refer to the same physical
port_a = SerialPort(2)
port_b = SerialPort(2)
assert port_b.is_shutdown() == False
assert port_b.is_shutdown() == True
But, why do they have to be the same object? Why should I care if
port_a is port_b
is False, as long as all operations I perform on either are reflected in
correct state changes on the other one?