[Python-3000] Thoughts on new I/O library and bytecode
Josiah Carlson
jcarlson at uci.edu
Mon Feb 26 04:58:39 CET 2007
Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
>
> Thomas Wouters wrote:
> >
> > I think you're confused. There isn't anything 'less generic' about the
> > bytes literal. Both bytes([...]) and b"..." can express the full 256
> > value range.
>
> Yes, but it only makes sense to try to display it as
> characters if it's meant to represent characters in
> the first place. Otherwise you get something that
> looks like line noise.
>
> BTW, I don't really think that bytes([104, 101, 108,
> 108, 111]) is the right way to display it either.
> There ought to be some kind of compact hex format.
> Maybe something like
>
> $[68656C6C6F]
I think it's a bad idea to choose a representation with any format that
isn't able to do the eval(repr(obj)) loop. I'm not a fan of 'bytes([101,
108, ...])', nor do I like 'bytes([0xd7, 0x19, ...])'. 'bytes(b"stuff")'
is a bit redundant, but it would get the point across. I'm not sure I
*like* b"stuff", but I don't loathe it like I do the other two that are
passed lists. Maybe 'bytes("stuff", "latin-1")', but then it is
underlying platform and/or file encoding sensitive. It may be the case
that b"stuff" is the most concise and reasonable repr form...
- Josiah
More information about the Python-3000
mailing list