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
171f3916
Kaydet (Commit)
171f3916
authored
Ock 16, 2008
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Minor wordsmithing.
üst
0f75f984
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
9 deletions
+29
-9
collections.rst
Doc/library/collections.rst
+1
-2
queue.rst
Doc/library/queue.rst
+28
-7
No files found.
Doc/library/collections.rst
Dosyayı görüntüle @
171f3916
...
...
@@ -536,8 +536,7 @@ faster versions that bypass error-checking::
return self._make(_map(kwds.get, ('x', 'y'), self))
The subclasses shown above set ``__slots__`` to an empty tuple. This keeps
the named tuples from having per-instance dictionaries, so they will
continue to be lightweight and require no more memory than regular tuples.
keep memory requirements low by preventing the creation of instance dictionaries.
Subclassing is not useful for adding new, stored fields. Instead, simply
create a new named tuple type from the :attr:`_fields` attribute::
...
...
Doc/library/queue.rst
Dosyayı görüntüle @
171f3916
...
...
@@ -6,23 +6,46 @@
:synopsis: A synchronized queue class.
The :mod:`Queue` module implements
a multi-producer, multi-consumer FIFO queue
.
The :mod:`Queue` module implements
multi-producer, multi-consumer queues
.
It is especially useful in threaded programming when information must be
exchanged safely between multiple threads. The :class:`Queue` class in this
module implements all the required locking semantics. It depends on the
availability of thread support in Python; see the :mod:`threading`
module.
The :mod:`Queue` module defines the following class and exception:
Implements three types of queue whose only difference is the order that
the entries are retrieved. In a FIFO queue, the first tasks added are
the first retrieved. In a LIFO queue, the most recently added entry is
the first retrieved (operating like a stack). With a priority queue,
the entries are kept sorted (using the :mod:`heapq` module) and the
lowest valued entry is retrieved first.
The :mod:`Queue` module defines the following classes and exceptions:
.. class:: Queue(maxsize)
Constructor for
the class
. *maxsize* is an integer that sets the upperbound
Constructor for
a FIFO queue
. *maxsize* is an integer that sets the upperbound
limit on the number of items that can be placed in the queue. Insertion will
block once this size has been reached, until queue items are consumed. If
*maxsize* is less than or equal to zero, the queue size is infinite.
.. class:: LifoQueue(maxsize)
Constructor for a LIFO queue. *maxsize* is an integer that sets the upperbound
limit on the number of items that can be placed in the queue. Insertion will
block once this size has been reached, until queue items are consumed. If
*maxsize* is less than or equal to zero, the queue size is infinite.
.. class:: PriorityQueue(maxsize)
Constructor for a priority queue. *maxsize* is an integer that sets the upperbound
limit on the number of items that can be placed in the queue. Insertion will
block once this size has been reached, until queue items are consumed. If
*maxsize* is less than or equal to zero, the queue size is infinite.
The lowest valued entries are retrieved first (the lowest valued entry is the
one returned by ``sorted(list(entries))[0]``). A typical pattern for entries
is a tuple in the form: ``(priority_number, data)``.
.. exception:: Empty
...
...
@@ -41,10 +64,8 @@ The :mod:`Queue` module defines the following class and exception:
Queue Objects
-------------
Class :class:`Queue` implements queue objects and has the methods described
below. This class can be derived from in order to implement other queue
organizations (e.g. stack) but the inheritable interface is not described here.
See the source code for details. The public methods are:
Queue objects (:class:``Queue``, :class:``LifoQueue``, or :class:``PriorityQueue``
provide the public methods described below.
.. method:: Queue.qsize()
...
...
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