[Python-Dev] Fwd: PEP 467: Minor API improvements for bytes & bytearray
chris.barker at noaa.gov
Mon Aug 18 18:04:06 CEST 2014
On Sun, Aug 17, 2014 at 2:41 PM, Barry Warsaw <barry at python.org> wrote:
> I think the biggest API "problem" is that default iteration returns
> instead of bytes. That's a real pain.
what is really needed for this NOT to be a pain is a byte scalar.
numpy has a scalar type for every type it supports -- this is a GOOD THING
In : a = np.array((3,4,5), dtype=np.uint8)
In : a
Out: array([3, 4, 5], dtype=uint8)
In : a
In : type(a)
In : a.shape
The lack of a character type is a major source of "type errors" in python
(the whole list of strings vs a single string problem -- both return a
sequence when you index into them or iterate over them)
Anyway, the character ship has long since sailed, but maybe a byte scalar
would be a good idea?
And FWIW, I think the proposal does make for a better, cleaner API.
Whether that's worth the deprecation is not clear to me, though as someone
whose been on the verge of making the leap to 3.* for ages, this isn't
going to make any difference.
Christopher Barker, Ph.D.
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.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-Dev