I'm into waiting lines. (Yes i know there are formulas and ready made modules available)
I imagine a bakery with random client arrivals (between x and y seconds)
This makes a queue which i can monitor every 5 seconds with the code below (that works.)
question 1: does this code look solid = python compliant ?
The queue will (later) be depleted by 1,2 or 3 personnel servicing te clients,each finishing in random a to b seconds.
question 2: can i start a second threading class (personnel) within the same __main__ (not interfering with my arrivals thread)?
Paul
I imagine a bakery with random client arrivals (between x and y seconds)
This makes a queue which i can monitor every 5 seconds with the code below (that works.)
question 1: does this code look solid = python compliant ?
The queue will (later) be depleted by 1,2 or 3 personnel servicing te clients,each finishing in random a to b seconds.
question 2: can i start a second threading class (personnel) within the same __main__ (not interfering with my arrivals thread)?
queue = 0 class arrivals(threading.Thread): def run(self): global queue while True: secs = random.randint(5,10) time.sleep(secs) queue += 1 myClients = arrivals() myClients.start() while True: print(queue) time.sleep(5)thx,
Paul
It is more important to do the right thing, than to do the thing right.(P.Drucker)
Better is the enemy of good. (Montesquieu) = French version for 'kiss'.
Better is the enemy of good. (Montesquieu) = French version for 'kiss'.