Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
0136e798
Commit
0136e798
authored
Oct 08, 2008
by
Andrew M. Kuchling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Note how bytes alias is expected to be used
parent
00c94ede
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
Doc/whatsnew/2.6.rst
Doc/whatsnew/2.6.rst
+14
-0
No files found.
Doc/whatsnew/2.6.rst
View file @
0136e798
...
...
@@ -949,6 +949,20 @@ or using a :class:`bytes` constructor. For future compatibility,
Python 2.6 adds :class:`bytes` as a synonym for the :class:`str` type,
and it also supports the ``b''`` notation.
The 2.6 :class:`str` differs from 3.0'
s
:
class
:`
bytes
`
type
in
various
ways
;
most
notably
,
the
constructor
is
completely
different
.
In
3.0
,
``
bytes
([
65
,
66
,
67
])``
is
3
elements
long
,
containing
the
bytes
representing
``
ABC
``;
in
2.6
,
``
bytes
([
65
,
66
,
67
])``
returns
the
12
-
byte
string
representing
the
:
func
:`
str
`
of
the
list
.
The
primary
use
of
:
class
:`
bytes
`
in
2.6
will
be
to
write
tests
of
object
type
such
as
``
isinstance
(
x
,
bytes
)``.
This
will
help
the
2
to3
converter
,
which
can
't tell whether 2.x code intends strings to
contain either characters or 8-bit bytes; you can now
use either :class:`bytes` or :class:`str` to represent your intention
exactly, and the resulting code will also be correct in Python 3.0.
There'
s
also
a
``
__future__
``
import
that
causes
all
string
literals
to
become
Unicode
strings
.
This
means
that
``\
u
``
escape
sequences
can
be
used
to
include
Unicode
characters
::
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment