mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Merged revisions 68221 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r68221 | georg.brandl | 2009-01-03 22:04:55 +0100 (Sat, 03 Jan 2009) | 2 lines Remove tabs from the documentation. ........
This commit is contained in:
parent
48310cd3f2
commit
a1c6a1cea5
18 changed files with 148 additions and 152 deletions
|
@ -297,7 +297,7 @@ So, to display a reverse-video status line on the top line of the screen, you
|
|||
could code::
|
||||
|
||||
stdscr.addstr(0, 0, "Current mode: Typing mode",
|
||||
curses.A_REVERSE)
|
||||
curses.A_REVERSE)
|
||||
stdscr.refresh()
|
||||
|
||||
The curses library also supports color on those terminals that provide it, The
|
||||
|
|
|
@ -917,7 +917,7 @@ module::
|
|||
|
||||
InternalDate = re.compile(r'INTERNALDATE "'
|
||||
r'(?P<day>[ 123][0-9])-(?P<mon>[A-Z][a-z][a-z])-'
|
||||
r'(?P<year>[0-9][0-9][0-9][0-9])'
|
||||
r'(?P<year>[0-9][0-9][0-9][0-9])'
|
||||
r' (?P<hour>[0-9][0-9]):(?P<min>[0-9][0-9]):(?P<sec>[0-9][0-9])'
|
||||
r' (?P<zonen>[-+])(?P<zoneh>[0-9][0-9])(?P<zonem>[0-9][0-9])'
|
||||
r'"')
|
||||
|
|
|
@ -189,30 +189,30 @@ length message::
|
|||
"""
|
||||
|
||||
def __init__(self, sock=None):
|
||||
if sock is None:
|
||||
self.sock = socket.socket(
|
||||
socket.AF_INET, socket.SOCK_STREAM)
|
||||
else:
|
||||
self.sock = sock
|
||||
if sock is None:
|
||||
self.sock = socket.socket(
|
||||
socket.AF_INET, socket.SOCK_STREAM)
|
||||
else:
|
||||
self.sock = sock
|
||||
|
||||
def connect(self, host, port):
|
||||
self.sock.connect((host, port))
|
||||
|
||||
def mysend(self, msg):
|
||||
totalsent = 0
|
||||
while totalsent < MSGLEN:
|
||||
sent = self.sock.send(msg[totalsent:])
|
||||
if sent == 0:
|
||||
raise RuntimeError("socket connection broken")
|
||||
totalsent = totalsent + sent
|
||||
totalsent = 0
|
||||
while totalsent < MSGLEN:
|
||||
sent = self.sock.send(msg[totalsent:])
|
||||
if sent == 0:
|
||||
raise RuntimeError("socket connection broken")
|
||||
totalsent = totalsent + sent
|
||||
|
||||
def myreceive(self):
|
||||
msg = ''
|
||||
while len(msg) < MSGLEN:
|
||||
chunk = self.sock.recv(MSGLEN-len(msg))
|
||||
if chunk == '':
|
||||
raise RuntimeError("socket connection broken")
|
||||
msg = msg + chunk
|
||||
chunk = self.sock.recv(MSGLEN-len(msg))
|
||||
if chunk == '':
|
||||
raise RuntimeError("socket connection broken")
|
||||
msg = msg + chunk
|
||||
return msg
|
||||
|
||||
The sending code here is usable for almost any messaging scheme - in Python you
|
||||
|
|
|
@ -32,8 +32,8 @@ For a while people just wrote programs that didn't display accents. I remember
|
|||
looking at Apple ][ BASIC programs, published in French-language publications in
|
||||
the mid-1980s, that had lines like these::
|
||||
|
||||
PRINT "FICHIER EST COMPLETE."
|
||||
PRINT "CARACTERE NON ACCEPTE."
|
||||
PRINT "FICHIER EST COMPLETE."
|
||||
PRINT "CARACTERE NON ACCEPTE."
|
||||
|
||||
Those messages should contain accents, and they just look wrong to someone who
|
||||
can read French.
|
||||
|
@ -91,11 +91,11 @@ standard, a code point is written using the notation U+12ca to mean the
|
|||
character with value 0x12ca (4810 decimal). The Unicode standard contains a lot
|
||||
of tables listing characters and their corresponding code points::
|
||||
|
||||
0061 'a'; LATIN SMALL LETTER A
|
||||
0062 'b'; LATIN SMALL LETTER B
|
||||
0063 'c'; LATIN SMALL LETTER C
|
||||
...
|
||||
007B '{'; LEFT CURLY BRACKET
|
||||
0061 'a'; LATIN SMALL LETTER A
|
||||
0062 'b'; LATIN SMALL LETTER B
|
||||
0063 'c'; LATIN SMALL LETTER C
|
||||
...
|
||||
007B '{'; LEFT CURLY BRACKET
|
||||
|
||||
Strictly, these definitions imply that it's meaningless to say 'this is
|
||||
character U+12ca'. U+12ca is a code point, which represents some particular
|
||||
|
@ -527,19 +527,19 @@ path will return the byte string versions of the filenames. For example,
|
|||
assuming the default filesystem encoding is UTF-8, running the following
|
||||
program::
|
||||
|
||||
fn = 'filename\u4500abc'
|
||||
f = open(fn, 'w')
|
||||
f.close()
|
||||
fn = 'filename\u4500abc'
|
||||
f = open(fn, 'w')
|
||||
f.close()
|
||||
|
||||
import os
|
||||
print(os.listdir(b'.'))
|
||||
print(os.listdir('.'))
|
||||
import os
|
||||
print(os.listdir(b'.'))
|
||||
print(os.listdir('.'))
|
||||
|
||||
will produce the following output::
|
||||
|
||||
amk:~$ python t.py
|
||||
[b'.svn', b'filename\xe4\x94\x80abc', ...]
|
||||
['.svn', 'filename\u4500abc', ...]
|
||||
amk:~$ python t.py
|
||||
[b'.svn', b'filename\xe4\x94\x80abc', ...]
|
||||
['.svn', 'filename\u4500abc', ...]
|
||||
|
||||
The first list contains UTF-8-encoded filenames, and the second list contains
|
||||
the Unicode versions.
|
||||
|
@ -636,26 +636,26 @@ Version 1.1: Feb-Nov 2008. Updates the document with respect to Python 3 change
|
|||
- [ ] Unicode introduction
|
||||
- [ ] ASCII
|
||||
- [ ] Terms
|
||||
- [ ] Character
|
||||
- [ ] Code point
|
||||
- [ ] Encodings
|
||||
- [ ] Common encodings: ASCII, Latin-1, UTF-8
|
||||
- [ ] Character
|
||||
- [ ] Code point
|
||||
- [ ] Encodings
|
||||
- [ ] Common encodings: ASCII, Latin-1, UTF-8
|
||||
- [ ] Unicode Python type
|
||||
- [ ] Writing unicode literals
|
||||
- [ ] Obscurity: -U switch
|
||||
- [ ] Built-ins
|
||||
- [ ] unichr()
|
||||
- [ ] ord()
|
||||
- [ ] unicode() constructor
|
||||
- [ ] Unicode type
|
||||
- [ ] encode(), decode() methods
|
||||
- [ ] Writing unicode literals
|
||||
- [ ] Obscurity: -U switch
|
||||
- [ ] Built-ins
|
||||
- [ ] unichr()
|
||||
- [ ] ord()
|
||||
- [ ] unicode() constructor
|
||||
- [ ] Unicode type
|
||||
- [ ] encode(), decode() methods
|
||||
- [ ] Unicodedata module for character properties
|
||||
- [ ] I/O
|
||||
- [ ] Reading/writing Unicode data into files
|
||||
- [ ] Byte-order marks
|
||||
- [ ] Unicode filenames
|
||||
- [ ] Reading/writing Unicode data into files
|
||||
- [ ] Byte-order marks
|
||||
- [ ] Unicode filenames
|
||||
- [ ] Writing Unicode programs
|
||||
- [ ] Do everything in Unicode
|
||||
- [ ] Declaring source code encodings (PEP 263)
|
||||
- [ ] Do everything in Unicode
|
||||
- [ ] Declaring source code encodings (PEP 263)
|
||||
- [ ] Other issues
|
||||
- [ ] Building Python (UCS2, UCS4)
|
||||
- [ ] Building Python (UCS2, UCS4)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue