[Pythonmac-SIG] \r vs. \n --> import hook?

Chris Barker chrishbarker@home.net
Fri, 06 Apr 2001 09:27:26 -0700


Jack Jansen wrote:
> Yes, this sounds like a good idea! Actually, it may be possible to create an
> import hook that runs on any system, and imports any of \r, \n, \r\n files.

It's clearly possible, and a darn good idea. I used to use MATLAB a lot,
and it could read code in text files of any of the three forms without
problems (almost without problems, some dos editors put a "end of file"
character at the end that it choked on). I've often wondered why Python
didn't have that feature. It's really a pain that a module actually HAS
to be different for each platform, just because of line ending issues.

> This would be a really nice addition to the core Python, because it would not
> only solve our problems but it would also allow you to access unix files on
> Samba partitions from a PC, PCNFS files from unix, etc etc etc.

I'm sorry that I simply don't have the skills to impliment it, but I
very strongly support the idea. While we're at it, I would love it if
when you opened a file as a text file, it could read any of the
supported formats transparently as well. 

Has anyone on the Python development group commented on this?

-Chris

-- 
Christopher Barker,
Ph.D.                                                           
ChrisHBarker@home.net                 ---           ---           ---
http://members.home.net/barkerlohmann ---@@       -----@@       -----@@
                                   ------@@@     ------@@@     ------@@@
Oil Spill Modeling                ------   @    ------   @   ------   @
Water Resources Engineering       -------      ---------     --------    
Coastal and Fluvial Hydrodynamics --------------------------------------
------------------------------------------------------------------------