I Accidentally Deleted 7TB of Videos Before Going to Production
> but at the time the code seemed completely correct to me<p>It always does.<p>> Well, it teaches me to do more diverse tests when doing destructive operations.<p>Or add some logging and do a dry run and check the results, literally simple prints statements:<p><pre><code>    print("-----")
    print("Downloading videos ids from url: {url}")
    print(list of ids)
    ...
    ...
    ...
    # delete()  dangerous action commented out until I'm sure it's right
    print("I'm about to delete video {id}")

    print("Deleted {count} videos") # maybe even assert
    ...
</code></pre>
Then dump out to a file and spot check it five times before running for real.