That blah and blah | cat should generate the same byte stream is a fine principle (though I wouldn’t be completely dogmatic about it; I think the behaviour of ls is useful). However, another important principle is that non-interactive execution like blah > file should not depend on which terminal you happen to run it from.
Python provides a simple way to adhere to both of these principles: don’t write character strings to file handles, only write byte strings.
(no subject)
Date: 2007-12-16 02:19 pm (UTC)blah
andblah | cat
should generate the same byte stream is a fine principle (though I wouldn’t be completely dogmatic about it; I think the behaviour ofls
is useful). However, another important principle is that non-interactive execution likeblah > file
should not depend on which terminal you happen to run it from.Python provides a simple way to adhere to both of these principles: don’t write character strings to file handles, only write byte strings.