If you need this, you’re probably doing it wrong. But if you really must check to see if a variable has been assigned yet, there’s nothing really stopping you. Here’s one way of implementing it.
So you want to kill a thread… Dangerous. How about asking a thread to die instead? Of course it’s unsafe to just kill a thread dead in its tracks. What if the thread has some resource acquired or is controlling other threads itself? It’s much better to communicate with a thread and tell it to stop, then just wait for it to kill itself.
I needed to encrypt some strings before sending them out over the network to another process and I don’t want to rely on another mechanism for handling the encryption, so here’s my simple AES encryption class. You can load plain text out of the vault by providing a cipher or save an encrypted message by supplying the plain text.
There are a few hidden easter eggs in python. So next time you fire up the python shell try to import hello and this. I wonder how many other hidden gems there are.