We can implement WSGI applications as
Callable objects instead of standalone functions. This allows us to have stateful processing in our WSGI server without the potential confusion of global variables. In our previous example, the
get_spin() WSGI application relied on two global variables,
european. The binding between the application and global can be mysterious.
The point of defining a class is to encapsulate the processing and data into a single package. We can use
Callable objects to encapsulate our applications in a better manner. This can make the binding between stateful
Wheel and WSGI applications clearer. Here is an extension to the
Wheel class that makes it into a callable WSGI ...