Ben Finney <ben+pyt...@benfinney.id.au>: > As has been pointed out to you, the whole point here is that string > objects often *are not* distinct, despite conceptually having distinct > cretion in the source.
You know full well that this initialization creates references to distinct objects: class ABC: IDLE = "IDLE" CONNECTING = "CONNECTING" CONNECTED = "CONNECTED" DISCONNECTING = "DISCONNECTING" DISCONNECTED = "DISCONNECTED" The 5 constants can (and should) be distinguished with the "is" operator. Using "==" in this case would be slightly misleading. You could define: class ABC: IDLE = None CONNECTING = 1 CONNECTED = list DISCONNECTING = MyDisconnecting(9) DISCONNECTED = float("nan") without changing the functionality of the state machine (as long as "is" is used to identify the state). Marko -- https://mail.python.org/mailman/listinfo/python-list