My Python script opens 2
with the following functions :
: function appending stuff to a
(global var) if stuff happens in a big loop.
: function displaying the last item added to the
every second with additional info.
The purpose of these 2 threads is that
contains a loop optimized to be very fast (~ 200 ms / iteration) so printing from inside would be pointless.
takes care of the output instead.
At the beginning, I set
list = 
, then start the threads. Inside
I get the last item of the list with
but if no stuff happend before, the list is still empty and the
IndexError: list index out of range
Is there a simple way (no
if not list
) to display
instead of an error if the list is empty ?