I was programming in python and I had two text editors open to the same file, and right before I shut down my computer I saved in the wrong one and overwrote the version I wanted to keep. How can I restore the old version? I'm using Mac OS X Snow Leopard
There is little hope unless one or both of the editors squirrel away copies of the file for you or embed the undo buffer in the document.
It really depends on the editors and the settings.
One last ditch effort is to use the
In this case, even software that recovers deleted files won't be of use when another editor truncates the file. It was shredded and not simply deleted
On a personal note, We all learn this lesson about data loss in a personal way, usually many times over.
It's not overkill to have both version control and an automated backup system.
Time Machine is marvelous in that it makes hourly snapshots so you lose at most an hours work. Files that have been around for [a day|a week] are saved for [a month|until the drive fills]. It really works well in practice, and if you have local backups, you might even have snapshots more often than one an hour to recover a file. Sorry to hear you lost work, it's never a good feeling.
You could try this: http://www.cgsecurity.org/wiki/TestDisk which is free undelete software, although it operates at the command line level. If you are happy with Python I will assume you are familiar enough with the terminal.app.
Other than that, Hope your backup caught the previous file, if you don't have a backup start making one, and/or consider switching to a text editor that provides for revisions/versions/backups etc. Prevention is better than cure, and being proactive with backups is better than being reactive with undeletes. Mistakes happen, I hop you can get your file back one way or another, and think about altering your workflow to try to prevent it happening again.
You don't mention which editors you were using. My primary editor is BBEdit which has a preference to make backups of every file you save. On my system the files are saved to:
This is set via the settings:
On a side note, I am so paranoid about backup that most of my projects are covered the following: