6 Oct 08:41
[Fwd: In Python 2.6, bytes is str]
From: Steve Holden <steve <at> holdenweb.com>
Subject: [Fwd: In Python 2.6, bytes is str]
Newsgroups: gmane.comp.python.devel
Date: 2008-10-06 06:43:45 GMT
Subject: [Fwd: In Python 2.6, bytes is str]
Newsgroups: gmane.comp.python.devel
Date: 2008-10-06 06:43:45 GMT
This does make it look rather as though bytes == str was a decision whose consequences weren't fully appreciated before implementation. Was this horror anticipated? regards Steve -------- Original Message -------- Subject: In Python 2.6, bytes is str Date: Sun, 05 Oct 2008 22:30:17 -0700 From: Bryan Olson <fakeaddress <at> nowhere.org> Organization: at&t http://my.att.net/ To: python-list <at> python.org Newsgroups: gmane.comp.python.general Python 3 has the 'bytes' type, which the string type I've long wanted in various languages. Among other advantages, it is immutable, and therefore bytes objects can be dict keys. There's a mutable version too, called "bytearray". In Python 2.6, the name 'bytes' is defined, and bound to str. The 2.6 assignment presents some pitfalls. Be aware. Consider constructing a bytes object as: b = bytes([68, 255, 0]) In Python 3.x, len(b) will be 3, which feels right.(Continue reading)
RSS Feed