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
aac8c58f
Commit
aac8c58f
authored
Jan 17, 2003
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Various markup changes.
parent
42b567fc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
20 deletions
+22
-20
Doc/whatsnew/whatsnew23.tex
Doc/whatsnew/whatsnew23.tex
+22
-20
No files found.
Doc/whatsnew/whatsnew23.tex
View file @
aac8c58f
...
...
@@ -3,7 +3,7 @@
\title
{
What's New in Python 2.3
}
\release
{
0.08
}
\author
{
A.M. Kuchling
}
\author
{
A.M.
\
Kuchling
}
\authoraddress
{
\email
{
amk@amk.ca
}}
\begin{document}
...
...
@@ -173,11 +173,11 @@ preserved. On the next call to the generator's \code{.next()} method,
the function will resume executing immediately after the
\keyword
{
yield
}
statement. (For complicated reasons, the
\keyword
{
yield
}
statement isn't allowed inside the
\keyword
{
try
}
block
of a
\
code
{
try...
finally
}
statement; read
\pep
{
255
}
for a full
of a
\
keyword
{
try
}
...
\keyword
{
finally
}
statement; read
\pep
{
255
}
for a full
explanation of the interaction between
\keyword
{
yield
}
and
exceptions.)
Here's a sample usage of the
\function
{
generate
_
ints
}
generator:
Here's a sample usage of the
\function
{
generate
_
ints
()
}
generator:
\begin{verbatim}
>>> gen = generate
_
ints(3)
...
...
@@ -472,7 +472,7 @@ string resulting from \code{\var{msg} \% (\var{arg1}, \var{arg2},
There's also an
\function
{
exception()
}
function that records the most
recent traceback. Any of the other functions will also record the
traceback if you specify a true value for the keyword argument
\
code
{
exc
_
info
}
.
\
var
{
exc
_
info
}
.
\begin{verbatim}
def f():
...
...
@@ -510,7 +510,7 @@ log.critical('Disk full')
Log records are usually propagated up the hierarchy, so a message
logged to
\samp
{
server.auth
}
is also seen by
\samp
{
server
}
and
\samp
{
root
}
, but a handler can prevent this by setting its
\member
{
propagate
}
attribute to
\co
de
{
False
}
.
\member
{
propagate
}
attribute to
\co
nstant
{
False
}
.
There are more classes provided by the
\module
{
logging
}
package that
can be customized. When a
\class
{
Logger
}
instance is told to log a
...
...
@@ -683,10 +683,10 @@ Python 2.3a0 (#1, Dec 30 2002, 19:54:32)
An entry in
\code
{
sys.path
}
can now be the filename of a ZIP archive.
The ZIP archive can contain any kind of files, but only files named
\
code
{
*.py
}
,
\code
{
*.pyc
}
, or
\cod
e
{
*.pyo
}
can be imported. If an
archive only contains
\
cod
e
{
*.py
}
files, Python will not attempt to
modify the archive by adding the corresponding
\
cod
e
{
*.pyc
}
file, meaning
that if a ZIP archive doesn't contain
\
cod
e
{
*.pyc
}
files, importing may be
\
file
{
*.py
}
,
\file
{
*.pyc
}
, or
\fil
e
{
*.pyo
}
can be imported. If an
archive only contains
\
fil
e
{
*.py
}
files, Python will not attempt to
modify the archive by adding the corresponding
\
fil
e
{
*.pyc
}
file, meaning
that if a ZIP archive doesn't contain
\
fil
e
{
*.pyc
}
files, importing may be
rather slow.
A path within the archive can also be specified to only import from a
...
...
@@ -767,14 +767,14 @@ are added to the \module{sys} module:
\begin{itemize}
\item
\code
{
sys.path
_
hooks
}
is a list of callable objects; most
often they'll be classes. Each callable takes a string containing
a
path and either returns an importer object that will handle imports
from this path or raises an
\exception
{
ImportError
}
exception if it
can't handle this path.
often they'll be classes. Each callable takes a string containing a
path and either returns an importer object that will handle imports
from this path or raises an
\exception
{
ImportError
}
exception if it
can't handle this path.
\item
\code
{
sys.path
_
importer
_
cache
}
caches importer objects for
each path, so
\code
{
sys.path
_
hooks
}
will only need to be traversed
once for each path.
each path, so
\code
{
sys.path
_
hooks
}
will only need to be traversed
once for each path.
\item
\code
{
sys.meta
_
path
}
is a list of importer objects that will
be traversed before
\code
{
sys.path
}
is checked. This list is
...
...
@@ -927,8 +927,9 @@ Or use slice objects directly in subscripts:
To simplify implementing sequences that support extended slicing,
slice objects now have a method
\method
{
indices(
\var
{
length
}
)
}
which,
given the length of a sequence, returns a
\code
{
(start, stop, step)
}
tuple that can be passed directly to
\function
{
range()
}
.
given the length of a sequence, returns a
\code
{
(
\var
{
start
}
,
\var
{
stop
}
,
\var
{
step
}
)
}
tuple that can be passed directly to
\function
{
range()
}
.
\method
{
indices()
}
handles omitted and out-of-bounds indices in a
manner consistent with regular slices (and this innocuous phrase hides
a welter of confusing details!). The method is intended to be used
...
...
@@ -1118,7 +1119,7 @@ In 2.3, you get this:
\begin{itemize}
\item
The
\
code
{
in
}
operator now works differently for strings.
\item
The
\
keyword
{
in
}
operator now works differently for strings.
Previously, when evaluating
\code
{
\var
{
X
}
in
\var
{
Y
}}
where
\var
{
X
}
and
\var
{
Y
}
are strings,
\var
{
X
}
could only be a single character.
That's now changed;
\var
{
X
}
can be a string of any length, and
...
...
@@ -1405,7 +1406,8 @@ will enable buffering.
\item
The
\function
{
sample(
\var
{
population
}
,
\var
{
k
}
)
}
function was
added to the
\module
{
random
}
module.
\var
{
population
}
is a sequence
or
\code
{
xrange
}
object containing the elements of a population, and
\function
{
sample()
}
or
\class
{
xrange
}
object containing the elements of a population, and
\function
{
sample()
}
chooses
\var
{
k
}
elements from the population without replacing chosen
elements.
\var
{
k
}
can be any value up to
\code
{
len(
\var
{
population
}
)
}
.
For example:
...
...
@@ -1933,7 +1935,7 @@ definition table can specify the
\constant
{
METH
_
NOARGS
}
flag, signalling that there are no arguments, and
the argument checking can then be removed. If compatibility with
pre
-
2
.
2
versions of Python is important, the code could use
\code
{
PyArg
_
ParseTuple
(
args
, ""
)
}
instead, but this will be slower
\code
{
PyArg
_
ParseTuple
(
\var
{
args
}
, ""
)
}
instead, but this will be slower
than using
\constant
{
METH
_
NOARGS
}
.
\item
A new function,
\cfunction
{
PyObject
_
DelItemString
(
\var
{
mapping
}
,
...
...
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