[Numpy-discussion] ANN: Numpy 1.6.0 beta 2

Matthew Brett matthew.brett at gmail.com
Tue Apr 5 17:56:59 EDT 2011


On Tue, Apr 5, 2011 at 9:46 AM, Christopher Barker
<Chris.Barker at noaa.gov> wrote:
> On 4/4/11 10:35 PM, Charles R Harris wrote:
>>     IIUC, "Ub" is undefined -- "U" means universal newlines, which makes no
>>     sense when used with "b" for binary. I looked at the code a ways back,
>>     and I can't remember the resolution order, but there isn't any checking
>>     for incompatible flags.

I disagree that U makes no sense for binary file reading.

In python 3:

'b' means, "return byte objects"
't' means "return decoded strings"

'U' means two things:

1) When iterating by line, split lines at any of '\r', '\r\n', '\n'
2) When returning lines split this way, convert '\r' and '\r\n' to '\n'

If you support returning lines from a binary file (which python 3
does), then I think 'U' is a sensible thing to allow - as in this



More information about the NumPy-Discussion mailing list