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
f6dab954
Kaydet (Commit)
f6dab954
authored
Nis 28, 2009
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Make the doctests in the docs pass, except for those in the turtle module.
üst
90c61a2e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
24 deletions
+28
-24
functional.rst
Doc/howto/functional.rst
+1
-1
collections.rst
Doc/library/collections.rst
+3
-3
decimal.rst
Doc/library/decimal.rst
+1
-1
subprocess.rst
Doc/library/subprocess.rst
+2
-2
2.7.rst
Doc/whatsnew/2.7.rst
+21
-17
No files found.
Doc/howto/functional.rst
Dosyayı görüntüle @
f6dab954
...
@@ -472,7 +472,7 @@ Here's a sample usage of the ``generate_ints()`` generator:
...
@@ -472,7 +472,7 @@ Here's a sample usage of the ``generate_ints()`` generator:
>>> gen = generate_ints(3)
>>> gen = generate_ints(3)
>>> gen
>>> gen
<generator object at ...>
<generator object
generate_ints
at ...>
>>> gen.next()
>>> gen.next()
0
0
>>> gen.next()
>>> gen.next()
...
...
Doc/library/collections.rst
Dosyayı görüntüle @
f6dab954
...
@@ -184,7 +184,7 @@ For example::
...
@@ -184,7 +184,7 @@ For example::
class is similar to bags or multisets in other languages.
class is similar to bags or multisets in other languages.
Elements are counted from an *iterable* or initialized from another
Elements are counted from an *iterable* or initialized from another
*mapping* (or counter):
:
*mapping* (or counter):
>>> c = Counter() # a new, empty counter
>>> c = Counter() # a new, empty counter
>>> c = Counter('gallahad') # a new counter from an iterable
>>> c = Counter('gallahad') # a new counter from an iterable
...
@@ -192,7 +192,7 @@ For example::
...
@@ -192,7 +192,7 @@ For example::
>>> c = Counter(cats=4, dogs=8) # a new counter from keyword args
>>> c = Counter(cats=4, dogs=8) # a new counter from keyword args
Counter objects have a dictionary interface except that they return a zero
Counter objects have a dictionary interface except that they return a zero
count for missing items instead of raising a :exc:`KeyError`:
:
count for missing items instead of raising a :exc:`KeyError`:
>>> c = Counter(['eggs', 'ham'])
>>> c = Counter(['eggs', 'ham'])
>>> c['bacon'] # count of a missing element is zero
>>> c['bacon'] # count of a missing element is zero
...
@@ -225,7 +225,7 @@ For example::
...
@@ -225,7 +225,7 @@ For example::
Return a list of the *n* most common elements and their counts from the
Return a list of the *n* most common elements and their counts from the
most common to the least. If *n* is not specified, :func:`most_common`
most common to the least. If *n* is not specified, :func:`most_common`
returns *all* elements in the counter. Elements with equal counts are
returns *all* elements in the counter. Elements with equal counts are
ordered arbitrarily:
:
ordered arbitrarily:
>>> Counter('abracadabra').most_common(3)
>>> Counter('abracadabra').most_common(3)
[('a', 5), ('r', 2), ('b', 2)]
[('a', 5), ('r', 2), ('b', 2)]
...
...
Doc/library/decimal.rst
Dosyayı görüntüle @
f6dab954
...
@@ -1850,7 +1850,7 @@ the :const:`Inexact` trap is set, it is also useful for validation:
...
@@ -1850,7 +1850,7 @@ the :const:`Inexact` trap is set, it is also useful for validation:
>>> Decimal('3.214').quantize(TWOPLACES, context=Context(traps=[Inexact]))
>>> Decimal('3.214').quantize(TWOPLACES, context=Context(traps=[Inexact]))
Traceback (most recent call last):
Traceback (most recent call last):
...
...
Inexact
Inexact
: None
Q. Once I have valid two place inputs, how do I maintain that invariant
Q. Once I have valid two place inputs, how do I maintain that invariant
throughout an application?
throughout an application?
...
...
Doc/library/subprocess.rst
Dosyayı görüntüle @
f6dab954
...
@@ -181,13 +181,13 @@ This module also defines two shortcut functions:
...
@@ -181,13 +181,13 @@ This module also defines two shortcut functions:
:attr:`returncode`
:attr:`returncode`
attribute and output in the :attr:`output` attribute.
attribute and output in the :attr:`output` attribute.
The arguments are the same as for the :class:`Popen` constructor. Example:
The arguments are the same as for the :class:`Popen` constructor. Example:
:
>>> subprocess.check_output(["ls", "-l", "/dev/null"])
>>> subprocess.check_output(["ls", "-l", "/dev/null"])
'crw-rw-rw- 1 root root 1, 3 Oct 18 2007 /dev/null\n'
'crw-rw-rw- 1 root root 1, 3 Oct 18 2007 /dev/null\n'
The stdout argument is not allowed as it is used internally.
The stdout argument is not allowed as it is used internally.
To capture standard error in the result, use
stderr=subprocess.STDOUT.
To capture standard error in the result, use
``stderr=subprocess.STDOUT``::
>>> subprocess.check_output(
>>> subprocess.check_output(
["/bin/sh", "-c", "ls non_existent_file ; exit 0"],
["/bin/sh", "-c", "ls non_existent_file ; exit 0"],
...
...
Doc/whatsnew/2.7.rst
Dosyayı görüntüle @
f6dab954
...
@@ -220,21 +220,24 @@ changes, or look through the Subversion logs for all the details.
...
@@ -220,21 +220,24 @@ changes, or look through the Subversion logs for all the details.
* New class: the :class:`Counter` class in the :mod:`collections` module is
* New class: the :class:`Counter` class in the :mod:`collections` module is
useful for tallying data. :class:`Counter` instances behave mostly
useful for tallying data. :class:`Counter` instances behave mostly
like dictionaries but return zero for missing keys instead of
like dictionaries but return zero for missing keys instead of
raising a :exc:`KeyError`::
raising a :exc:`KeyError`:
>>> from collections import Counter
.. doctest::
>>> c=Counter()
:options: +NORMALIZE_WHITESPACE
>>> for letter in 'here is a sample of english text':
... c[letter] += 1
>>> from collections import Counter
...
>>> c = Counter()
>>> c
>>> for letter in 'here is a sample of english text':
Counter({' ': 6, 'e': 5, 's': 3, 'a': 2, 'i': 2, 'h': 2,
... c[letter] += 1
'l': 2, 't': 2, 'g': 1, 'f': 1, 'm': 1, 'o': 1, 'n': 1,
...
'p': 1, 'r': 1, 'x': 1})
>>> c
>>> c['e']
Counter({' ': 6, 'e': 5, 's': 3, 'a': 2, 'i': 2, 'h': 2,
5
'l': 2, 't': 2, 'g': 1, 'f': 1, 'm': 1, 'o': 1, 'n': 1,
>>> c['z']
'p': 1, 'r': 1, 'x': 1})
0
>>> c['e']
5
>>> c['z']
0
There are two additional :class:`Counter` methods: :meth:`most_common`
There are two additional :class:`Counter` methods: :meth:`most_common`
returns the N most common elements and their counts, and :meth:`elements`
returns the N most common elements and their counts, and :meth:`elements`
...
@@ -247,7 +250,7 @@ changes, or look through the Subversion logs for all the details.
...
@@ -247,7 +250,7 @@ changes, or look through the Subversion logs for all the details.
'a', 'a', ' ', ' ', ' ', ' ', ' ', ' ',
'a', 'a', ' ', ' ', ' ', ' ', ' ', ' ',
'e', 'e', 'e', 'e', 'e', 'g', 'f', 'i', 'i',
'e', 'e', 'e', 'e', 'e', 'g', 'f', 'i', 'i',
'h', 'h', 'm', 'l', 'l', 'o', 'n', 'p', 's',
'h', 'h', 'm', 'l', 'l', 'o', 'n', 'p', 's',
's', 's', 'r', 't', 't', 'x'
]
's', 's', 'r', 't', 't', 'x'
Contributed by Raymond Hettinger; :issue:`1696199`.
Contributed by Raymond Hettinger; :issue:`1696199`.
...
@@ -257,7 +260,8 @@ changes, or look through the Subversion logs for all the details.
...
@@ -257,7 +260,8 @@ changes, or look through the Subversion logs for all the details.
renamed to legal names that are derived from the field's
renamed to legal names that are derived from the field's
position within the list of fields:
position within the list of fields:
>>> T=namedtuple('T', ['field1', '$illegal', 'for', 'field2'], rename=True)
>>> from collections import namedtuple
>>> T = namedtuple('T', ['field1', '$illegal', 'for', 'field2'], rename=True)
>>> T._fields
>>> T._fields
('field1', '_1', '_2', 'field2')
('field1', '_1', '_2', 'field2')
...
...
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