All my functions are red
April 13, 2024
If you haven’t read Bob Nystroms frustrated article about asynchronous programming already, go do it. It’s here and it’s fantastic.
Now, it seems like all my bits are red.
Today, this has happened many times.
/some/long/path/to/file.py:22: RuntimeWarning: coroutine 'foobar' was never awaited
foobar()
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
This is by itself quite good, the interpreter told me about a problem. Thanks mister computer interpreter sir, I appreciate it!
The problem is that when I add await
to this call, I just get the same error
message for the level above in the stack. And on an on it goes until every
function in that call stack is painted red like tipping a full can of paint down
the stairs.
Frustrating indeed!!
This makes it harder to test, hard to grasp and harder to modify. What’s the bloody point!?
…
Now, admittedly I’m quite new to the whole asyncio
in Python system and I have to
wrap my head around it. It does not come natural for me though. I think the
system is quite complicated, much more complicated than threads
. To be perfectly
honest though, I don’t think the high-level idea of an event loop is
complicated, but the way it’s stuffed into the way that you code is just so
impractical.
I should probably go study this thing, to help my future self with the inevitable high blood pressure.