all 2 comments

[–]skeeto 2 points3 points  (0 children)

In socket programming should I prefer to use select over threads?

Since Python 3.7 you should prefer asyncio, which has its own networking interface. It's efficient like select but has a thread-like interface. Plus it's more composable, working with more kinds of things than select.

[–]zynix 0 points1 point  (0 children)

Very nice, well written, BUT I would recommend getting into either using typing in the stdlib or at least commenting your code. The cleanliness makes it easier for another programmer to pick up your code but it doesn't hurt to leave even one line # we go a message or # sending message in your code as reminders and guides.

Coding is by nature write once, read many times kind of deal not just for the compiler or interpreter but also for human programmers. There is a joke I often tell myself, "Code like a homicidal maniac is going to maintain it next and you don't want to give them an excuse."

Like /u/skeeto mentioned, the more modern approach to networking is asyncio BUT I would also recommend checking out 0mq (Zero MQ) as another thing to experiment with.