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
143d034e
Kaydet (Commit)
143d034e
authored
Eki 12, 2012
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
merge 3.2
üst
c3de6d63
7a9953ed
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
70 additions
and
59 deletions
+70
-59
glossary.rst
Doc/glossary.rst
+1
-1
functional.rst
Doc/howto/functional.rst
+0
-0
2to3.rst
Doc/library/2to3.rst
+1
-1
concurrent.futures.rst
Doc/library/concurrent.futures.rst
+12
-10
dis.rst
Doc/library/dis.rst
+4
-4
functions.rst
Doc/library/functions.rst
+11
-10
stdtypes.rst
Doc/library/stdtypes.rst
+5
-4
datamodel.rst
Doc/reference/datamodel.rst
+4
-4
expressions.rst
Doc/reference/expressions.rst
+12
-11
classes.rst
Doc/tutorial/classes.rst
+9
-9
3.0.rst
Doc/whatsnew/3.0.rst
+2
-2
platform.py
Lib/platform.py
+6
-1
test_runpy.py
Lib/test/test_runpy.py
+2
-2
test_timeit.py
Lib/test/test_timeit.py
+1
-0
No files found.
Doc/glossary.rst
Dosyayı görüntüle @
143d034e
...
...
@@ -365,7 +365,7 @@ Glossary
iterator
An
object
representing
a
stream
of
data
.
Repeated
calls
to
the
iterator
's
:meth:`__next__` method (or passing it to the built-in function
:meth:`
~iterator.
__next__` method (or passing it to the built-in function
:func:`next`) return successive items in the stream. When no more data
are available a :exc:`StopIteration` exception is raised instead. At this
point, the iterator object is exhausted and any further calls to its
...
...
Doc/howto/functional.rst
Dosyayı görüntüle @
143d034e
This diff is collapsed.
Click to expand it.
Doc/library/2to3.rst
Dosyayı görüntüle @
143d034e
...
...
@@ -23,7 +23,7 @@ Using 2to3
also located in the :file:`Tools/scripts` directory of the Python root.
2to3's basic arguments are a list of files or directories to transform. The
directories are
to
recursively traversed for Python sources.
directories are recursively traversed for Python sources.
Here is a sample Python 2.x source file, :file:`example.py`::
...
...
Doc/library/concurrent.futures.rst
Dosyayı görüntüle @
143d034e
...
...
@@ -42,12 +42,13 @@ Executor Objects
Equivalent to ``map(func, *iterables)`` except *func* is executed
asynchronously and several calls to *func* may be made concurrently. The
returned iterator raises a :exc:`TimeoutError` if :meth:`__next__()` is
called and the result isn't available after *timeout* seconds from the
original call to :meth:`Executor.map`. *timeout* can be an int or a
float. If *timeout* is not specified or ``None``, there is no limit to
the wait time. If a call raises an exception, then that exception will
be raised when its value is retrieved from the iterator.
returned iterator raises a :exc:`TimeoutError` if
:meth:`~iterator.__next__` is called and the result isn't available
after *timeout* seconds from the original call to :meth:`Executor.map`.
*timeout* can be an int or a float. If *timeout* is not specified or
``None``, there is no limit to the wait time. If a call raises an
exception, then that exception will be raised when its value is
retrieved from the iterator.
.. method:: shutdown(wait=True)
...
...
@@ -364,10 +365,11 @@ Module Functions
different :class:`Executor` instances) given by *fs* that yields futures as
they complete (finished or were cancelled). Any futures that completed
before :func:`as_completed` is called will be yielded first. The returned
iterator raises a :exc:`TimeoutError` if :meth:`__next__` is called and the
result isn't available after *timeout* seconds from the original call to
:func:`as_completed`. *timeout* can be an int or float. If *timeout* is not
specified or ``None``, there is no limit to the wait time.
iterator raises a :exc:`TimeoutError` if :meth:`~iterator.__next__` is
called and the result isn't available after *timeout* seconds from the
original call to :func:`as_completed`. *timeout* can be an int or float.
If *timeout* is not specified or ``None``, there is no limit to the wait
time.
.. seealso::
...
...
Doc/library/dis.rst
Dosyayı görüntüle @
143d034e
...
...
@@ -660,10 +660,10 @@ the more significant byte last.
.. opcode:: FOR_ITER (delta)
``TOS`` is an :term:`iterator`. Call its :meth:`
__next__` method. If this
yields a new value, push it on the stack (leaving the iterator below it). If
the iterator indicates it is exhausted ``TOS`` is popped, and the byte cod
e
counter is incremented by *delta*.
``TOS`` is an :term:`iterator`. Call its :meth:`
~iterator.__next__` method.
If this yields a new value, push it on the stack (leaving the iterator below
it). If the iterator indicates it is exhausted ``TOS`` is popped, and th
e
byte code
counter is incremented by *delta*.
.. opcode:: LOAD_GLOBAL (namei)
...
...
Doc/library/functions.rst
Dosyayı görüntüle @
143d034e
...
...
@@ -348,10 +348,10 @@ are always available. They are listed here in alphabetical order.
.. function:: enumerate(iterable, start=0)
Return an enumerate object. *iterable* must be a sequence, an
:term:`iterator`, or some other object which supports iteration.
The
:meth:`__next__` method of the iterator returned by :func:`enumerate` returns a
tuple containing a count (from *start* which defaults to 0) and the
values obtained from iterating over *iterable*.
:term:`iterator`, or some other object which supports iteration.
The :meth:`~iterator.__next__` method of the iterator returned by
:func:`enumerate` returns a tuple containing a count (from *start* which
defaults to 0) and the
values obtained from iterating over *iterable*.
>>> seasons = ['Spring', 'Summer', 'Fall', 'Winter']
>>> list(enumerate(seasons))
...
...
@@ -683,9 +683,10 @@ are always available. They are listed here in alphabetical order.
starting at ``0``). If it does not support either of those protocols,
:exc:`TypeError` is raised. If the second argument, *sentinel*, is given,
then *object* must be a callable object. The iterator created in this case
will call *object* with no arguments for each call to its :meth:`__next__`
method; if the value returned is equal to *sentinel*, :exc:`StopIteration`
will be raised, otherwise the value will be returned.
will call *object* with no arguments for each call to its
:meth:`~iterator.__next__` method; if the value returned is equal to
*sentinel*, :exc:`StopIteration` will be raised, otherwise the value will
be returned.
One useful application of the second form of :func:`iter` is to read lines of
a file until a certain line is reached. The following example reads a file
...
...
@@ -779,9 +780,9 @@ are always available. They are listed here in alphabetical order.
.. function:: next(iterator[, default])
Retrieve the next item from the *iterator* by calling its
:meth:`__next__`
method. If *default* is given, it is returned if the iterator is exhausted,
otherwise :exc:`StopIteration` is raised.
Retrieve the next item from the *iterator* by calling its
:meth:`~iterator.__next__` method. If *default* is given, it is returned
if the iterator is exhausted,
otherwise :exc:`StopIteration` is raised.
.. function:: object()
...
...
Doc/library/stdtypes.rst
Dosyayı görüntüle @
143d034e
...
...
@@ -779,9 +779,9 @@ specific sequence types, dictionaries, and other more specialized forms. The
specific types are not important beyond their implementation of the iterator
protocol.
Once an iterator's :meth:`
__next__` method raises :exc:`StopIteration`, it must
continue to do so on subsequent calls. Implementations that do not obey this
property are deemed broken.
Once an iterator's :meth:`
~iterator.__next__` method raises
:exc:`StopIteration`, it must continue to do so on subsequent calls.
Implementations that do not obey this
property are deemed broken.
.. _generator-types:
...
...
@@ -792,7 +792,8 @@ Generator Types
Python's :term:`generator`\s provide a convenient way to implement the iterator
protocol. If a container object's :meth:`__iter__` method is implemented as a
generator, it will automatically return an iterator object (technically, a
generator object) supplying the :meth:`__iter__` and :meth:`__next__` methods.
generator object) supplying the :meth:`__iter__` and :meth:`~generator.__next__`
methods.
More information about generators can be found in :ref:`the documentation for
the yield expression <yieldexpr>`.
...
...
Doc/reference/datamodel.rst
Dosyayı görüntüle @
143d034e
...
...
@@ -600,9 +600,9 @@ Callable types
A function or method which uses the :keyword:`yield` statement (see section
:ref:`yield`) is called a :dfn:`generator function`. Such a function, when
called, always returns an iterator object which can be used to execute the
body of the function: calling the iterator's :meth:`
__next__` method will
cause the function to execute until it provides a value using th
e
:keyword:`yield` statement. When the function executes a
body of the function: calling the iterator's :meth:`
iterator__next__`
method will cause the function to execute until it provides a valu
e
using the
:keyword:`yield` statement. When the function executes a
:keyword:`return` statement or falls off the end, a :exc:`StopIteration`
exception is raised and the iterator will have reached the end of the set of
values to be returned.
...
...
@@ -1189,7 +1189,7 @@ Basic customization
builtin: print
Called by the :func:`format` built-in function (and by extension, the
:meth:`format` method of class :class:`str`) to produce a "formatted"
:meth:`
str.
format` method of class :class:`str`) to produce a "formatted"
string representation of an object. The ``format_spec`` argument is
a string that contains a description of the formatting options desired.
The interpretation of the ``format_spec`` argument is up to the type
...
...
Doc/reference/expressions.rst
Dosyayı görüntüle @
143d034e
...
...
@@ -294,13 +294,13 @@ for comprehensions, except that it is enclosed in parentheses instead of
brackets or curly braces.
Variables used in the generator expression are evaluated lazily when the
:meth:`
__next__` method is called for generator object (in the same fashion as
normal generators). However, the leftmost :keyword:`for` clause is immediately
evaluated, so that an error produced by it can be seen before any other possible
error in the code that handles the generator expression. Subsequent
:keyword:`for` clauses cannot be evaluated immediately since they may depend on
the previous :keyword:`for` loop. For example: ``(x*y for x in range(10) for y
in bar(x))``.
:meth:`
~generator.__next__` method is called for generator object (in the same
fashion as normal generators). However, the leftmost :keyword:`for` clause is
immediately evaluated, so that an error produced by it can be seen before any
other possible error in the code that handles the generator expression.
Subsequent :keyword:`for` clauses cannot be evaluated immediately since they
may depend on the previous :keyword:`for` loop. For example: ``(x*y for x in
range(10) for y
in bar(x))``.
The parentheses can be omitted on calls with only one argument. See section
:ref:`calls` for the detail.
...
...
@@ -394,10 +394,11 @@ is already executing raises a :exc:`ValueError` exception.
Starts the execution of a generator function or resumes it at the last
executed :keyword:`yield` expression. When a generator function is resumed
with a :meth:`__next__` method, the current :keyword:`yield` expression
always evaluates to :const:`None`. The execution then continues to the next
:keyword:`yield` expression, where the generator is suspended again, and the
value of the :token:`expression_list` is returned to :meth:`next`'s caller.
with a :meth:`~generator.__next__` method, the current :keyword:`yield`
expression always evaluates to :const:`None`. The execution then continues
to the next :keyword:`yield` expression, where the generator is suspended
again, and the value of the :token:`expression_list` is returned to
:meth:`next`'s caller.
If the generator exits without yielding another value, a :exc:`StopIteration`
exception is raised.
...
...
Doc/tutorial/classes.rst
Dosyayı görüntüle @
143d034e
...
...
@@ -737,11 +737,11 @@ using a :keyword:`for` statement::
This style of access is clear, concise, and convenient. The use of iterators
pervades and unifies Python. Behind the scenes, the :keyword:`for` statement
calls :func:`iter` on the container object. The function returns an iterator
object that defines the method :meth:`
__next__` which accesses elements in the
container one at a time. When there are no more elements, :meth:`__next__`
raises a :exc:`StopIteration` exception which tells the :keyword:`for` loop to
terminate. You can call the :meth:`__next__` method using the :func:`next`
built-in function; this example shows how it all works::
object that defines the method :meth:`
~iterator.__next__` which accesses
elements in the container one at a time. When there are no more elements,
:meth:`__next__` raises a :exc:`StopIteration` exception which tells the
:keyword:`for` loop to terminate. You can call the :meth:`__next__` method
using the :func:`next`
built-in function; this example shows how it all works::
>>> s = 'abc'
>>> it = iter(s)
...
...
@@ -761,8 +761,8 @@ built-in function; this example shows how it all works::
Having seen the mechanics behind the iterator protocol, it is easy to add
iterator behavior to your classes. Define an :meth:`__iter__` method which
returns an object with a :meth:`
__next__` method. If the class define
s
:meth:`__next__`, then :meth:`__iter__` can just return ``self``::
returns an object with a :meth:`
~iterator.__next__` method. If the clas
s
defines
:meth:`__next__`, then :meth:`__iter__` can just return ``self``::
class Reverse:
"""Iterator for looping over a sequence backwards."""
...
...
@@ -819,8 +819,8 @@ easy to create::
Anything that can be done with generators can also be done with class based
iterators as described in the previous section. What makes generators so
compact is that the :meth:`__iter__` and :meth:`
__next__` methods are created
automatically.
compact is that the :meth:`__iter__` and :meth:`
~generator.__next__` methods
a
re created a
utomatically.
Another key feature is that the local variables and execution state are
automatically saved between calls. This made the function easier to write and
...
...
Doc/whatsnew/3.0.rst
Dosyayı görüntüle @
143d034e
...
...
@@ -771,7 +771,7 @@ Operators And Special Methods
respectively).
* :pep:`3114`: the standard :meth:`next` method has been renamed to
:meth:`__next__`.
:meth:`
~iterator.
__next__`.
* The :meth:`__oct__` and :meth:`__hex__` special methods are removed
-- :func:`oct` and :func:`hex` use :meth:`__index__` now to convert
...
...
@@ -807,7 +807,7 @@ Builtins
To get the old behavior of :func:`input`, use ``eval(input())``.
* A new built-in function :func:`next` was added to call the
:meth:`__next__` method on an object.
:meth:`
~iterator.
__next__` method on an object.
* The :func:`round` function rounding strategy and return type have
changed. Exact halfway cases are now rounded to the nearest even
...
...
Lib/platform.py
Dosyayı görüntüle @
143d034e
...
...
@@ -595,8 +595,13 @@ def win32_ver(release='',version='',csd='',ptype=''):
release
=
'7'
else
:
release
=
'2008ServerR2'
elif
min
==
2
:
if
product_type
==
VER_NT_WORKSTATION
:
release
=
'8'
else
:
release
=
'2012Server'
else
:
release
=
'post20
08
Server'
release
=
'post20
12
Server'
else
:
if
not
release
:
...
...
Lib/test/test_runpy.py
Dosyayı görüntüle @
143d034e
...
...
@@ -565,10 +565,10 @@ class RunPathTestCase(unittest.TestCase, CodeExecutionMixin):
with
open
(
filename
,
'w'
,
encoding
=
'latin1'
)
as
f
:
f
.
write
(
"""
#coding:latin1
"non-ASCII: h
\xe9
"
s =
"non-ASCII: h
\xe9
"
"""
)
result
=
run_path
(
filename
)
self
.
assertEqual
(
result
[
'
__doc__
'
],
"non-ASCII: h
\xe9
"
)
self
.
assertEqual
(
result
[
'
s
'
],
"non-ASCII: h
\xe9
"
)
def
test_main
():
...
...
Lib/test/test_timeit.py
Dosyayı görüntüle @
143d034e
...
...
@@ -250,6 +250,7 @@ class TestTimeit(unittest.TestCase):
s
=
self
.
run_main
(
seconds_per_increment
=
60.0
,
switches
=
[
'-r-5'
])
self
.
assertEqual
(
s
,
"10 loops, best of 1: 60 sec per loop
\n
"
)
@unittest.skipIf
(
sys
.
flags
.
optimize
>=
2
,
"need __doc__"
)
def
test_main_help
(
self
):
s
=
self
.
run_main
(
switches
=
[
'-h'
])
# Note: It's not clear that the trailing space was intended as part of
...
...
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