When I wrote the first edition of this book, I shipped two copies of every example file on the CD-ROM (view CD-ROM content online at http://examples.oreilly.com/python2) -- one with Unix line-end markers, and one with DOS markers. The idea was that this would make it easy to view and edit the files on either platform. Readers would simply copy the examples directory tree designed for their platform onto their hard drive, and ignore the other one.
If you read Chapter 2, you know the issue here:
DOS (and by proxy, Windows) marks line ends in text files with the
\r\n (carriage-return, line-feed),
but Unix uses just a single
\n. Most modern text
editors don’t care -- they happily display text files
encoded in either format. Some tools are less forgiving, though. I
still occasionally see odd
\r characters when
viewing DOS files on Unix, or an entire file in a single line when
looking at Unix files on DOS (the Notepad accessory does this on
Windows, for example).
Because this is only an occasional annoyance, and because it’s easy to forget to keep two distinct example trees in sync, I adopted a different policy for this second edition: we’re shipping a single copy of the examples (in DOS format), along with a portable converter tool for changing to and from other line-end formats.
The main obstacle, of course, is how to go about providing a portable and easy to use converter -- one that runs “out of the box” on almost every computer, without changes ...