On Thu, Jul 17, 2014 at 8:48 AM, Nathaniel Smith <n...@pobox.com> wrote:
> I'd be very concerned about backcompat for existing code that uses > e.g. "S128" as a dtype to mean "128 arbitrary bytes". yup -- 'S' matches teh py2 string well, which is BOTH text and bytes. That should not change -- at least in py2. > An example is > this file format reading code: > https://github.com/rerpy/rerpy/blob/master/rerpy/io/erpss.py#L123 > The file format says there are 128 bytes there, and their > interpretation depends on other fields in the header -- but in one > case, for "large montages", there's an encoding where every 3 bytes > represents 4 characters using an ad hoc 6-bit character set: > https://github.com/rerpy/rerpy/blob/master/rerpy/io/erpss.py#L133 > > Perhaps this case could be handled better by using a u8 subarray or > something (that code also goes to some efforts to work around nul padding), yes -- that might have been better, though I have not been successful at figuring out how to spell a dtype that works well -- hence my suggestion that we have a bytes type. > and that particular project hasn't been ported to py3 yet so > technically wouldn't be affected if we changed the meaning of "S" on > py3. But it does seem useful to have a "fixed length bytes" dtype even > in py3, and if we declare that be "S" then it avoids breaking any > existing code depending on it... > sure, but having 'S' be bytes does break other code that depends on it being a text type. Unfortunately, py2 mingled text and bytes, numpy mirrored that, so there is no completely backward compatible way to go forward. But for some guidance -- text is the big issue with py2 <-> p3 migration, so folks are presumable going to expect things to change with numpy text handling as well. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception chris.bar...@noaa.gov
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion