Okay, so I wanted to mess around with naming conventions, specifically for something I jokingly call “Russian Roulette.” The idea is, you have a script or function that might delete something important, and you want the name to reflect that danger. Here’s how I went about it:
Brainstorming Risky Names
First, I just started listing out words that came to mind when I thought about risk, danger, and randomness. Stuff like:
gamble
chance
delete_maybe
unpredictable
risky_operation
destroyer
lucky
I wrote all these down. I wanted a good mix of obvious and slightly-less-obvious names.
Playing with Prefixes and Suffixes
Then I thought about adding little prefixes or suffixes to make them sound even more, you know, programmer-y. Some ideas I kicked around:
do_ (like, `do_gamble`) – Made it sound like an action, but a dangerous one.
_unsafe (like, `delete_maybe_unsafe`) – Very explicit!
Adding numbers, just for fun (`destroyer6`)– Why not? It’s random, right?
Implementing the Script
After listing name, I started to create a Python script. I added a random check to make the function “risky”
import random
def delete_maybe():
if *(0, 5) == 0:
print("Files deleted!")
else:
print("Files are safe...this time.")
Testing and (Almost) Panicking
I started testing it. I ran it a few times. Saw the “Files deleted!” message pop up. Even though I knew it wasn’t actually deleting anything, it still gave me a tiny jolt each time. My heart beat up, I thought that it is really deleted.
My Takeaway
Honestly, this was a lot of practice on naming function. I had fun to pick up scary and funny names for a function. It also reminded me that even though names can be funny, they should also be informative. If I really had a script that could delete important stuff, I’d probably go with something super clear like `delete_with_extreme_caution`… and then back up everything three times.