|
Re: [Python-Dev] Implementing File Modes: msg#00657python-dev
My motivation came from an instance when I was using subprocess.Popen for a Linux / Windows cross platform program. In part of the program, I was writing and reading to a cron like object. On Windows, it was a text file and on Linux it would be the crontab executable. Had I been able to substitute the "open()" function with my wrapper, it would have been the only change I had to make for cross platform compatibility; instead of having to change numerous lines because Linux would need Popen and Windows would need a regular file open(), I could simply make it so that if the platform was Linux, my wrapper is used in place of that. Just another example would be having an external program decrypt a file that can be in plain text or encrypted that might go something like this: if encryptionEnabled: fileobj = subprocess.ProcessIOWrapper("gpg --decrypt supersecret.html.gpg") else: fileobj = open("notsosecret.html") From there, the functions would not have to be modified despite using a running process versus a file object. On Tue, Jul 28, 2009 at 01:53, Gregory P. Smith <greg@xxxxxxxxxx> wrote:
_______________________________________________ Python-Dev mailing list Python-Dev@xxxxxxxxxx http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/maillists%40codeha.us
|
|
||||||||||||||||||||||||||
| News | Mail Home | sitemap | FAQ | advertise |