On Fri, Jun 27, 2008 at 5:16 AM, Facundo Batista <[EMAIL PROTECTED]> wrote: > 2008/6/26 Georg Brandl <[EMAIL PROTECTED]>: > >> Yes. Bytes objects are sequences of bytes, which are integers. >> So, in short, this is the way they work. > > I think that the OP confusion comes from the representation. > > We have a data type called bytes. They are sequences of bytes. So, I build > one: > >>>> b = bytes((72, 105)) > > > Then I check: > >>>> b[0] > 72 >>>> b[1] > 105 > > > Great! But: > >>>> b > b'Hi' > > > Why I see two letters? Wasn't them bytes? :o > > I know that is great to represent bytes between 32 and 127 as letters, > and this has several compatibility details, but I think that the > surprise comes from that place. > > If the behaviour were the following.... > >>>> b > b((72, 105)) > > ...it would be less surprising.
Only if you didn't know that b'' is an alternative to bytes(). The b'' notation is so much more compact and so much more helpful that I really don't want to go back to it. We will somehow have to deal with this through education and documentation. -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com