Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b492fa9

Browse files
committed
Mention dict.fromkeys()
Various edits
1 parent 5ef2b21 commit b492fa9

1 file changed

Lines changed: 29 additions & 18 deletions

File tree

Doc/whatsnew/whatsnew23.tex

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -615,11 +615,11 @@ \section{PEP 293: Codec Error Handling Callbacks}
615615
the error processing as either ``strict'' (raising
616616
\exception{UnicodeError}), ``ignore'' (skip the character), or
617617
``replace'' (with question mark), defaulting to ``strict''. It may be
618-
desirable to specify an alternative processing of the error, e.g. by
618+
desirable to specify an alternative processing of the error, such as
619619
inserting an XML character reference or HTML entity reference into the
620620
converted string.
621621

622-
Python now has a flexible framework to add additional processing
622+
Python now has a flexible framework to add different processing
623623
strategies. New error handlers can be added with
624624
\function{codecs.register_error}. Codecs then can access the error
625625
handler with \function{codecs.lookup_error}. An equivalent C API has
@@ -631,7 +631,7 @@ \section{PEP 293: Codec Error Handling Callbacks}
631631

632632
Two additional error handlers have been implemented using this
633633
framework: ``backslashreplace'' uses Python backslash quoting to
634-
represent the unencodable character, and ``xmlcharrefreplace'' emits
634+
represent unencodable characters and ``xmlcharrefreplace'' emits
635635
XML character references.
636636

637637
\begin{seealso}
@@ -821,7 +821,13 @@ \section{Other Language Changes}
821821
>>>
822822
\end{verbatim}
823823

824-
(Patch contributed by Raymond Hettinger.)
824+
There's also a new class method,
825+
\method{dict.fromkeys(\var{iterable}, \var{value})}, that
826+
creates a dictionary with keys taken from the supplied iterator
827+
\var{iterable} and all values set to \var{value}, defaulting to
828+
\code{None}.
829+
830+
(Patches contributed by Raymond Hettinger.)
825831

826832
\item The \keyword{assert} statement no longer checks the \code{__debug__}
827833
flag, so you can no longer disable assertions by assigning to \code{__debug__}.
@@ -1283,29 +1289,28 @@ \section{New and Improved Modules}
12831289
activated on an application level instead of trying to enable it on a
12841290
per-use basis.
12851291

1286-
\item Calling Tcl methods through \module{_tkinter} now does not
1287-
always return strings anymore. Instead, if Tcl returns other objects,
1288-
those objects are converted to their Python equivalent, if one exists,
1289-
or wrapped with a \class{_tkinter.Tcl_Obj} object if no Python
1290-
equivalent exists. This behaviour can be controlled through the
1291-
\method{wantobjects} method of \class{tkapp} objects.
1292+
\item Calling Tcl methods through \module{_tkinter} no longer
1293+
returns only strings. Instead, if Tcl returns other objects those
1294+
objects are converted to their Python equivalent, if one exists, or
1295+
wrapped with a \class{_tkinter.Tcl_Obj} object if no Python equivalent
1296+
exists. This behaviour can be controlled through the
1297+
\method{wantobjects()} method of \class{tkapp} objects.
12921298

1293-
When using _tkinter through Tkinter.py (i.e. for most _tkinter
1294-
applications), this feature is always activated. It should not cause
1295-
compatibility problems, since Tkinter would always convert string
1296-
results to Python types were possible.
1299+
When using \module{_tkinter} through the \module{Tkinter} module (as
1300+
most Tkinter applications will), this feature is always activated. It
1301+
should not cause compatibility problems, since Tkinter would always
1302+
convert string results to Python types where possible.
12971303

12981304
If any incompatibilities are found, the old behaviour can be restored
1299-
by invoking
1305+
by setting the \member{wantobjects} variable in the \module{Tkinter}
1306+
module to false before creating the first \class{tkapp} object.
13001307

13011308
\begin{verbatim}
13021309
import Tkinter
13031310
Tkinter.wantobjects = 0
13041311
\end{verbatim}
13051312

1306-
before creating the first \class{tkapp} object.
1307-
1308-
Please report any such breakage as a bug.
1313+
Please report any breakage caused by this change as a bug.
13091314

13101315
\end{itemize}
13111316

@@ -1652,6 +1657,12 @@ \section{Porting to Python 2.3}
16521657
integer instead of raising an \exception{OverflowError} when a string
16531658
or floating-point number is too large to fit into an integer.
16541659

1660+
\item Calling Tcl methods through \module{_tkinter} no longer
1661+
returns only strings. Instead, if Tcl returns other objects those
1662+
objects are converted to their Python equivalent, if one exists, or
1663+
wrapped with a \class{_tkinter.Tcl_Obj} object if no Python equivalent
1664+
exists.
1665+
16551666
\item You can no longer disable assertions by assigning to \code{__debug__}.
16561667

16571668
\item The Distutils \function{setup()} function has gained various new

0 commit comments

Comments
 (0)