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
7642f7af
Commit
7642f7af
authored
Sep 13, 2004
by
Andrew M. Kuchling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Credit patch from Raymond
parent
8278860e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
13 deletions
+34
-13
Doc/whatsnew/whatsnew24.tex
Doc/whatsnew/whatsnew24.tex
+34
-13
No files found.
Doc/whatsnew/whatsnew24.tex
View file @
7642f7af
...
...
@@ -756,11 +756,13 @@ language.
\item
The
\method
{
dict.update
()
}
method now accepts the same
argument forms as the
\class
{
dict
}
constructor. This includes any
mapping, any iterable of key
/
value pairs, and keyword arguments.
mapping, any iterable of key
/
value pairs, and keyword arguments.
(
Contributed by Raymond Hettinger.
)
\item
The string methods
\method
{
ljust
()
}
,
\method
{
rjust
()
}
, and
\method
{
center
()
}
now take an optional argument for specifying a
fill character other than a space.
(
Contributed by Raymond Hettinger.
)
\item
Strings also gained an
\method
{
rsplit
()
}
method that
works like the
\method
{
split
()
}
method but splits from the end of
...
...
@@ -776,6 +778,7 @@ the string.
\item
The
\method
{
sort
()
}
method of lists gained three keyword
arguments:
\var
{
cmp
}
,
\var
{
key
}
, and
\var
{
reverse
}
. These arguments
make some common usages of
\method
{
sort
()
}
simpler. All are optional.
(
Contributed by Raymond Hettinger.
)
\var
{
cmp
}
is the same as the previous single argument to
\method
{
sort
()
}
; if provided, the value should be a comparison
...
...
@@ -860,6 +863,8 @@ red 1
yellow
5
\end
{
verbatim
}
(
Contributed by Raymond Hettinger.
)
\item
Integer operations will no longer trigger an
\exception
{
OverflowWarning
}
.
The
\exception
{
OverflowWarning
}
warning will disappear in Python
2
.
5
.
...
...
@@ -884,7 +889,8 @@ Python dictionary. (Contributed by Raymond Hettinger.)
>>> transpose
([])
[]
\end
{
verbatim
}
(
Contributed by Raymond Hettinger.
)
\item
Encountering a failure while importing a module no longer leaves
a partially
-
initialized module object in
\code
{
sys.modules
}
. The
incomplete module object left behind would fool further imports of the
...
...
@@ -892,6 +898,7 @@ same module into succeeding, leading to confusing errors.
\item
\constant
{
None
}
is now a constant; code that binds a new value to
the name
\samp
{
None
}
is now a syntax error.
(
Contributed by Raymond Hettinger.
)
\end
{
itemize
}
...
...
@@ -906,6 +913,7 @@ the name \samp{None} is now a syntax error.
were also optimized for dictionaries, resulting in performance boosts for
\method
{
keys
()
}
,
\method
{
values
()
}
,
\method
{
items
()
}
,
\method
{
iterkeys
()
}
,
\method
{
itervalues
()
}
, and
\method
{
iteritems
()
}
.
(
Contributed by Raymond Hettinger.
)
\item
The machinery for growing and shrinking lists was optimized for
speed and for space efficiency. Appending and popping from lists now
...
...
@@ -913,12 +921,12 @@ the name \samp{None} is now a syntax error.
the underlying system
\cfunction
{
realloc
()
}
. List comprehensions
also benefit.
\method
{
list.extend
()
}
was also optimized and no
longer converts its argument into a temporary list before extending
the base list.
the base list.
(
Contributed by Raymond Hettinger.
)
\item
\function
{
list
()
}
,
\function
{
tuple
()
}
,
\function
{
map
()
}
,
\function
{
filter
()
}
, and
\function
{
zip
()
}
now run several times
faster with non
-
sequence arguments that supply a
\method
{__
len
__
()
}
method.
method.
(
Contributed by Raymond Hettinger.
)
\item
The methods
\method
{
list.
__
getitem
__
()
}
,
\method
{
dict.
__
getitem
__
()
}
, and
\method
{
dict.
__
contains
__
()
}
are
...
...
@@ -927,10 +935,11 @@ the name \samp{None} is now a syntax error.
access doubles their performance and makes them more suitable for
use as arguments to functionals:
\samp
{
map
(
mydict.
__
getitem
__
, keylist
)
}
.
(
Contributed by Raymond Hettinger.
)
\item
Added a new opcode,
\code
{
LIST
_
APPEND
}
, that simplifies
the generated bytecode for list comprehensions and speeds them up
by about a third.
by about a third.
(
Contributed by Raymond Hettinger.
)
\item
String concatenations in statements of the form
\code
{
s
=
s
+
"abc"
}
and
\code
{
s
+=
"abc"
}
are now performed more efficiently in
...
...
@@ -938,6 +947,7 @@ certain circumstances. This optimization won't be present in other
Python implementations such as Jython, so you shouldn't rely on it;
using the
\method
{
join
()
}
method of strings is still recommended when
you want to efficiently glue a large number of strings together.
(
Contributed by Armin Rigo.
)
\end
{
itemize
}
...
...
@@ -1015,7 +1025,7 @@ True
Several modules now take advantage of
\class
{
collections.deque
}
for
improved performance, such as the
\module
{
Queue
}
and
\module
{
threading
}
modules.
\module
{
threading
}
modules.
(
Contributed by Raymond Hettinger.
)
\item
The
\module
{
ConfigParser
}
classes have been enhanced slightly.
The
\method
{
read
()
}
method now returns a list of the files that
...
...
@@ -1044,7 +1054,7 @@ any problems as a \member{defect} attribute of the message.
high volumes of data. In addition, the module has two new functions
\function
{
nlargest
()
}
and
\function
{
nsmallest
()
}
that use heaps to
find the N largest or smallest values in a dataset without the
expense of a full sort.
expense of a full sort.
(
Contributed by Raymond Hettinger.
)
\item
The
\module
{
imaplib
}
module now supports IMAP's THREAD command
(
contributed by Yves Dionne
)
and new
\method
{
deleteacl
()
}
and
...
...
@@ -1103,6 +1113,8 @@ r ['r', 'r']
[(
'a',
5
)
,
(
'b',
2
)
,
(
'c',
1
)
,
(
'd',
1
)
,
(
'r',
2
)]
\end
{
verbatim
}
(
Contributed by Hye
-
Shik Chang.
)
\item
\module
{
itertools
}
also gained a function named
\function
{
tee
(
\var
{
iterator
}
,
\var
{
N
}
)
}
that returns
\var
{
N
}
independent
iterators that replicate
\var
{
iterator
}
. If
\var
{
N
}
is omitted, the
...
...
@@ -1127,6 +1139,7 @@ If the separation is large, then you might as well use
\function
{
list
()
}
instead. When the iterators track closely with one
another,
\function
{
tee
()
}
is ideal. Possible applications include
bookmarking, windowing, or lookahead iterators.
(
Contributed by Raymond Hettinger.
)
\item
A number of functions were added to the
\module
{
locale
}
module, such as
\function
{
bind
_
textdomain
_
codeset
()
}
to specify a
...
...
@@ -1176,6 +1189,8 @@ data extractors when used with \function{map()} or
[(
'd',
1
)
,
(
'c',
2
)
,
(
'b',
3
)
,
(
'a',
4
)]
\end
{
verbatim
}
(
Contributed by Raymond Hettinger.
)
\item
The
\module
{
optparse
}
module was updated. The module now passes
its messages through
\function
{
gettext.gettext
()
}
, making it possible
to internationalize Optik's help and error messages. Help messages
...
...
@@ -1203,12 +1218,14 @@ not it's a symbolic link. This differs from the existing
\item
The
\module
{
poplib
}
module now supports POP over SSL.
\item
The
\module
{
profile
}
module can now profile C extension functions.
% XXX more to say about this?
% XXX more to say about this?
(
Contributed by Nick Bastin.
)
\item
The
\module
{
random
}
module has a new method called
\method
{
getrandbits
(
N
)
}
which returns an N
-
bit long integer. This method supports the existing
\method
{
randrange
()
}
method, making it possible to efficiently generate
arbitrarily large random numbers.
(
Contributed by Raymond Hettinger.
)
\item
The regular expression language accepted by the
\module
{
re
}
module
was extended with simple conditional expressions, written as
...
...
@@ -1261,11 +1278,12 @@ Other threads can assign and retrieve their own values for the
\item
The
\module
{
timeit
}
module now automatically disables periodic
garbarge collection during the timing loop. This change makes
consecutive timings more comparable.
consecutive timings more comparable.
(
Contributed by Raymond Hettinger.
)
\item
The
\module
{
weakref
}
module now supports a wider variety of objects
including Python functions, class instances, sets, frozensets, deques,
arrays, files, sockets, and regular expression pattern objects.
(
Contributed by Raymond Hettinger.
)
\item
The
\module
{
xmlrpclib
}
module now supports a multi
-
call extension for
transmitting multiple XML
-
RPC calls in a single HTTP operation.
...
...
@@ -1315,18 +1333,19 @@ Changes to Python's build process and to the C API include:
\item
Three new convenience macros were added for common return
values from extension functions:
\csimplemacro
{
Py
_
RETURN
_
NONE
}
,
\csimplemacro
{
Py
_
RETURN
_
TRUE
}
, and
\csimplemacro
{
Py
_
RETURN
_
FALSE
}
.
(
Contributed by Brett Cannon.
)
\item
Another new macro,
\csimplemacro
{
Py
_
CLEAR
(
\var
{
obj
}
)
}
,
decreases the reference count of
\var
{
obj
}
and sets
\var
{
obj
}
to the
null pointer.
null pointer.
(
Contributed by Jim Fulton.
)
\item
A new function,
\cfunction
{
PyTuple
_
Pack
(
\var
{
N
}
,
\var
{
obj
1
}
,
\var
{
obj
2
}
, ...,
\var
{
objN
}
)
}
, constructs tuples from a variable
length argument list of Python objects.
length argument list of Python objects.
(
Contributed by Raymond Hettinger.
)
\item
A new function,
\cfunction
{
PyDict
_
Contains
(
\var
{
d
}
,
\var
{
k
}
)
}
,
implements fast dictionary lookups without masking exceptions raised
during the look
-
up process.
during the look
-
up process.
(
Contributed by Raymond Hettinger.
)
\item
A new function,
\cfunction
{
PyArg
_
VaParseTupleAndKeywords
()
}
,
is the same as
\cfunction
{
PyArg
_
ParseTupleAndKeywords
()
}
but takes a
...
...
@@ -1336,7 +1355,7 @@ Changes to Python's build process and to the C API include:
\item
A new method flag,
\constant
{
METH
_
COEXISTS
}
, allows a function
defined in slots to co
-
exist with a
\ctype
{
PyCFunction
}
having the
same name. This can halve the access time for a method such as
\method
{
set.
__
contains
__
()
}
.
\method
{
set.
__
contains
__
()
}
.
(
Contributed by Raymond Hettinger.
)
\item
Python can now be built with additional profiling for the
interpreter itself. This is intended for people developing on the
...
...
@@ -1359,6 +1378,7 @@ Changes to Python's build process and to the C API include:
\begin
{
itemize
}
\item
The Windows port now builds under MSVC
++
7
.
1
as well as version
6
.
(
Contributed by Martin von Loewis.
)
\end
{
itemize
}
...
...
@@ -1375,6 +1395,7 @@ changes to your code:
\item
The
\function
{
zip
()
}
built
-
in function and
\function
{
itertools.izip
()
}
now return an empty list instead of raising a
\exception
{
TypeError
}
exception if called with no arguments.
(
Contributed by Raymond Hettinger.
)
\item
\function
{
dircache.listdir
()
}
now passes exceptions to the caller
instead of returning empty lists.
...
...
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