[Python-Dev] PEP 358 (bytes type) comments
Bob Ippolito
bob at redivi.com
Wed Feb 22 23:03:29 CET 2006
More information about the Python-Dev mailing list
Wed Feb 22 23:03:29 CET 2006
- Previous message: [Python-Dev] PEP 358 (bytes type) comments
- Next message: [Python-Dev] [ python-Feature Requests-1436243 ] Extend pre-allocated integers to cover [0, 255]
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Feb 22, 2006, at 1:22 PM, Brett Cannon wrote: > First off, thanks to Neil for writing this all down. The whole thread > of discussion on the bytes type was rather long and thus hard to > follow. Nice to finally have it written down in a PEP. > > Anyway, a few comments on the PEP. One, should the hex() method > instead be an attribute, implemented as a property? Seems like static > data that is entirely based on the value of the bytes object and thus > is not properly represented by a method. > > Next, why are the __*slice__ methods to be defined? Docs say they are > deprecated. > > And for the open-ended questions, I don't think sort() is needed. sort would be totally useless for bytes. array.array doesn't have sort either. > Lastly, maybe I am just dense, but it took me a second to realize that > it will most likely return the ASCII string for __str__() for use in > something like socket.send(), but it isn't explicitly stated anywhere. > There is a chance someone might think that __str__ will somehow > return the sequence of integers as a string does exist. That would be a bad idea given that bytes are supposed make the str type go away. It's probably better to make __str__ return __repr__ like it does for most types. If bytes type supports the buffer API (one would hope so), functions like socket.send should do the right thing as-is. http://docs.python.org/api/bufferObjects.html -bob
- Previous message: [Python-Dev] PEP 358 (bytes type) comments
- Next message: [Python-Dev] [ python-Feature Requests-1436243 ] Extend pre-allocated integers to cover [0, 255]
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list