Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
fad2f593
Kaydet (Commit)
fad2f593
authored
May 10, 2002
tarafından
Andrew M. Kuchling
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Give the enumerate() PEP a section of its own
Add some credits Fill in a link
üst
007c04a9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
36 deletions
+50
-36
whatsnew23.tex
Doc/whatsnew/whatsnew23.tex
+50
-36
No files found.
Doc/whatsnew/whatsnew23.tex
Dosyayı görüntüle @
fad2f593
...
@@ -215,9 +215,44 @@ and implemented by Jack Jansen.}
...
@@ -215,9 +215,44 @@ and implemented by Jack Jansen.}
\end{seealso}
\end{seealso}
%======================================================================
%======================================================================
\section
{
PEP 285: The
\class
{
bool
}
Type
\label
{
section-bool
}}
\section
{
PEP 279: The
\function
{
enumerate()
}
Built-in Function
}
A new built-in function,
\function
{
enumerate()
}
, will make
certain loops a bit clearer.
\code
{
enumerate(thing)
}
, where
\var
{
thing
}
is either an iterator or a sequence, returns a iterator
that will return
\code
{
(0,
\var
{
thing[0]
}
)
}
,
\code
{
(1,
\var
{
thing[1]
}
)
}
,
\code
{
(2,
\var
{
thing[2]
}
)
}
, and so forth. Fairly
often you'll see code to change every element of a list that looks
like this:
\begin{verbatim}
for i in range(len(L)):
item = L[i]
# ... compute some result based on item ...
L[i] = result
\end{verbatim}
This can be rewritten using
\function
{
enumerate()
}
as:
\begin{verbatim}
for i, item in enumerate(L):
# ... compute some result based on item ...
L[i] = result
\end{verbatim}
\begin{seealso}
\seepep
{
279
}{
The enumerate() built-in function
}{
Written
by Raymond D. Hettinger.
}
\end{seealso}
%======================================================================
\section
{
PEP 285: The
\class
{
bool
}
Type
\label
{
section-bool
}}
A Boolean type was added to Python 2.3. Two new constants were added
A Boolean type was added to Python 2.3. Two new constants were added
to the
\module
{__
builtin
__}
module,
\constant
{
True
}
and
to the
\module
{__
builtin
__}
module,
\constant
{
True
}
and
...
@@ -292,41 +327,20 @@ strings \samp{True} and \samp{False} instead of \samp{1} and \samp{0}.
...
@@ -292,41 +327,20 @@ strings \samp{True} and \samp{False} instead of \samp{1} and \samp{0}.
%======================================================================
%======================================================================
\section
{
Other Language Changes
}
%\section{Other Language Changes}
Here are the changes that Python 2.3 makes to the core language.
\begin{itemize}
\item
The
\keyword
{
yield
}
statement is now always a keyword, as
described in section~
\ref
{
section-generators
}
.
\item
Two new constants,
\constant
{
True
}
and
\constant
{
False
}
were
added along with the built-in
\class
{
bool
}
type, as described in
section~
\ref
{
section-bool
}
.
\item
A new built-in function,
\function
{
enumerate()
}
, will make
certain loops a bit clearer.
\code
{
enumerate(thing)
}
, where
\var
{
thing
}
is either an iterator or a sequence, returns a iterator
that will return
\code
{
(0,
\var
{
thing[0]
}
)
}
,
\code
{
(1,
\var
{
thing[1]
}
)
}
,
\code
{
(2,
\var
{
thing[2]
}
)
}
, and so forth. Fairly
often you'll see code to change every element of a list that looks like this:
\begin{verbatim}
%Here are the changes that Python 2.3 makes to the core language.
for i in range(len(L)):
item = L[i]
# ... compute some result based on item ...
L[i] = result
\end{verbatim}
This can be rewritten using
\function
{
enumerate()
}
as:
%\begin{itemize}
%\item The \keyword{yield} statement is now always a keyword, as
%described in section~\ref{section-generators}.
\begin{verbatim}
%\item Two new constants, \constant{True} and \constant{False} were
for i, item in enumerate(L):
%added along with the built-in \class{bool} type, as described in
# ... compute some result based on item ...
%section~\ref{section-bool}.
L[i] = result
\end{verbatim}
\end{itemize}
%\item
%\end{itemize}
%======================================================================
%======================================================================
...
@@ -386,7 +400,7 @@ support, turn on the Python interpreter's debugging code by running
...
@@ -386,7 +400,7 @@ support, turn on the Python interpreter's debugging code by running
\begin{seealso}
\begin{seealso}
\seeurl
{
XXX
}
\seeurl
{
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/python/python/dist/src/Objects/obmalloc.c
}
{
For the full details of the pymalloc implementation, see
{
For the full details of the pymalloc implementation, see
the comments at the top of the file
\file
{
Objects/obmalloc.c
}
in the
the comments at the top of the file
\file
{
Objects/obmalloc.c
}
in the
Python source code. The above link points to the file within the
Python source code. The above link points to the file within the
...
@@ -491,7 +505,7 @@ packages for use on HP-UX. (Contributed by Mark Alexander.)
...
@@ -491,7 +505,7 @@ packages for use on HP-UX. (Contributed by Mark Alexander.)
characters using the
\samp
{
u
}
format character. Arrays also
characters using the
\samp
{
u
}
format character. Arrays also
now support using the
\code
{
+=
}
assignment operator to add another array's
now support using the
\code
{
+=
}
assignment operator to add another array's
contents, and the
\code
{
*=
}
assignment operator to repeat an array.
contents, and the
\code
{
*=
}
assignment operator to repeat an array.
(Contributed by
XXX
.)
(Contributed by
Jason Orendorff
.)
\item
The
\module
{
grp
}
module now returns enhanced tuples:
\item
The
\module
{
grp
}
module now returns enhanced tuples:
...
@@ -518,8 +532,8 @@ Changes to Python's build process, and to the C API, include:
...
@@ -518,8 +532,8 @@ Changes to Python's build process, and to the C API, include:
\item
Python can now optionally be built as a shared library
\item
Python can now optionally be built as a shared library
(
\file
{
libpython2.3.so
}
) by supplying
\longprogramopt
{
enable-shared
}
(
\file
{
libpython2.3.so
}
) by supplying
\longprogramopt
{
enable-shared
}
when running Python's
\file
{
configure
}
script. (Contributed by
XXX
when running Python's
\file
{
configure
}
script. (Contributed by
Ondrej
Pa
tch
\#
527027
)
Pa
lkovsky.
)
\item
The
\cfunction
{
PyArg
_
NoArgs()
}
macro is now deprecated, and code
\item
The
\cfunction
{
PyArg
_
NoArgs()
}
macro is now deprecated, and code
that
that
...
...
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