
Nick, I'm trying to reply to your message, but I can't figure out how. You mentioned that the PEP needs a "champion". What would that involve? How much time and effort would it take? What kinds of decisions would I make? The iterbytes thing in the PEP is something I was wishing for, while working on a personal project. I stumbled upon this PEP and decided to try to implement it myself, to learn about C and the Python internals, among other reasons. I don't know how I would feel working on something so general, of use to so many people for lots of different purposes. Do I know enough about all of the use cases and what everyone wants? I am not completely against it but I'd need to think about it. On Wed, Feb 21, 2018 at 2:36 PM, Chris Barker <chris.barker@noaa.gov> wrote:
On Wed, Feb 21, 2018 at 12:39 PM, Steve Holden <steve@holdenweb.com> wrote:
I think the chances of a "byte" object are about as good as the chances of a character object
probably right.
(though one can always implement such in C extensions, that wouldn't build them into the syntax).
I think you could simply subclass, too (overriding __new__ and a couple methods). But that would do exactly no good, unless you used your own custom string and bytes objects, too. The whole point is that iterating over a string (Or bytes) always returns an also-iterable object, ad-infinitum.
This is the cause of the major remaining common "type error" in Python. (the old integer division used to be the big one)
The fact that characters are single-byte strings is responsible for certain anomalies with (e.g.) the __contains__ operator (list elements aren't lists, but string element are strings), but overall the choices made lead to sensible, comprehensible code.
I'm pretty convinced that the choice not to have a character type has had basically zero benefits to sensible, comprehensible code, though it's not a very big deal, either. not a big enough deal for the churn it would cause to introduce it now, that's for sure.
so +1 for this PEP as is.
-CHB
--
Christopher Barker, Ph.D. Oceanographer
Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE <https://maps.google.com/?q=7600+Sand+Point+Way+NE&entry=gmail&source=g> (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@noaa.gov