[Python-Dev] [Python-checkins] cpython: #13251: update string description in datamodel.rst. (original) (raw)
Petri Lehtinen petri at digip.org
Tue Oct 25 14:45:24 CEST 2011
- Previous message: [Python-Dev] memcmp performance
- Next message: [Python-Dev] [Python-checkins] cpython: Issue #13226: Add RTLD_xxx constants to the os module. These constants can by
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi,
ezio.melotti wrote:
http://hg.python.org/cpython/rev/11d18ebb2dd1 changeset: 73116:11d18ebb2dd1 user: Ezio Melotti <ezio.melotti at gmail.com> date: Tue Oct 25 09:23:42 2011 +0300 summary: #13251: update string description in datamodel.rst.
files: Doc/reference/datamodel.rst | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -276,16 +276,16 @@ single: integer single: Unicode - The items of a string object are Unicode code units. A Unicode code - unit is represented by a string object of one item and can hold either - a 16-bit or 32-bit value representing a Unicode ordinal (the maximum - value for the ordinal is given in
sys.maxunicode
, and depends on - how Python is configured at compile time). Surrogate pairs may be - present in the Unicode object, and will be reported as two separate - items. The built-in functions :func:chr
and :func:ord
convert - between code units and nonnegative integers representing the Unicode - ordinals as defined in the Unicode Standard 3.0. Conversion from and to - other encodings are possible through the string method :meth:encode
. + A string is a sequence of values that represent Unicode codepoints. + All the codepoints in rangeU+0000 - U+10FFFF
can be represented + in a string. Python doesn't have a :c:type:chr
type, and + every characters in the string is represented as a string object typo ^
Should be "character", right?
+ with length
1
. The built-in function :func:chr
converts a + character to its codepoint (as an integer); :func:ord
converts + an integer in range0 - 10FFFF
to the corresponding character.
Actually chr() converts an integer to a string and ord() converts a string to an integer. chr and ord are swapped in your text.
+ :meth:
str.encode
can be used to convert a :class:str
to + :class:bytes
using the given encoding, and :meth:bytes.decode
can + be used to achieve the opposite.
Petri
- Previous message: [Python-Dev] memcmp performance
- Next message: [Python-Dev] [Python-checkins] cpython: Issue #13226: Add RTLD_xxx constants to the os module. These constants can by
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]