Skip to content

Tag: python

How to make enumerate not count blank’s indexes?

I am trying to writing a function which will take a sentence and make each odd letter an uppercase one and each even letter a lowercase one. Here is what I tried: When the input is “Hello my guy”, the output is “HeLlO My gUy” and not “HeLlO mY gUy” because it counts blank a…

Python: will a thread ever unblock while hanging on a `Queue.get(block=True)` call if the queue is suddenly destroyed from another thread/process?

TLDR: Would a blocking get be unblocked by a queue that would be terminated in some way? Long question: Okay, so I know that the thread will hang if the queue (multiprocessing.Queue) remains empty forever while trying to fetch something from it with a blocking get. But suppose now that in another thread or pr…