Questions tagged [python]
Post a PromptPrompts producing Python programs.
20 prompts
10votes
3answers
2.0kviews
Prompt for an idempotent cron/systemd maintenance script that's safe to run twice
Our nightly cleanup job used to assume it ran exactly once and finished. Then a run overlapped with the next one, they both deleted the same temp files, and one crashed mid-way leaving a half-cleaned
5votes
0answers
969views
Splitting a 600-line god function into pure units without behavior drift
The worst function in our codebase does input parsing, three network calls, retry logic, formatting, and logging in one 600-line block. I wanted GPT to carve it into small pure functions plus a thin o
8votes
1answers
894views
Turning a messy matplotlib notebook into one reproducible plotting script
I had a research notebook with 40 cells of exploratory plots, half of them relying on variables defined three cells up and a global rcParams tweak that only worked if you ran things in order. Sharing
13votes
0answers
1.5kviews
Making the model generate a config loader with validation instead of raw os.environ reads
Half our incidents traced back to config: an env var typo'd to an empty string, a port that was actually the literal text "8080" compared against an int, a feature flag that was the string "false" (wh
12votes
1answers
1.4kviews
Prompt for a bulk file-rename CLI with a regex, a dry-run, and collision detection
Batch renaming is exactly the kind of task where a model gives you a confident three-liner that renames files in a loop and, halfway through, renames a.txt to b.txt on top of an existing b.txt, or ren