compsci

Python Tip: Global, auto-incrementing IDs for class instances WITHOUT module-scope variables

This will be a short one, but it’s something you can easily apply to your own code when managing objects that must be indexable by an ID or be referenced in some downstream code. Recently, one of our developers wrote an entity system in a Python game server that they purpose-built for a toy game, […]

Python Tip: Global, auto-incrementing IDs for class instances WITHOUT module-scope variables Read More »

handle wsaewouldblock

WSAEWOULDBLOCK and EAGAIN using select() in Python

Handling socket errors when making non-blocking select() or event loop servers in Python is important, since otherwise your program simply won’t work. If it doesn’t make the distinction between socket errors that cause a disconnect, or socket errors that mean you simply need to wait, your program will be incorrect. It may kill connections or

WSAEWOULDBLOCK and EAGAIN using select() in Python Read More »

Scroll to Top