I think the biggest API "problem" is that default iteration returns integers
">

(original) (raw)

On Sun, Aug 17, 2014 at 2:41 PM, Barry Warsaw <barry@python.org> wrote:
I think the biggest API "problem" is that default iteration returns integers

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 (tm):


In \[53\]: a = np.array((3,4,5), dtype=np.uint8)

In \[54\]: a
Out\[54\]: array(\[3, 4, 5\], dtype=uint8)

In \[55\]: a\[1\]
Out\[55\]: 4

In \[56\]: type(a\[1\])
Out\[56\]: numpy.uint8

In \[57\]: a\[1\].shape
Out\[57\]: ()


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.

-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.Barker@noaa.gov