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
d404fa6e
Kaydet (Commit)
d404fa6e
authored
Eki 13, 2009
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Update module names in references in the FAQ.
üst
d741315f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
15 deletions
+11
-15
library.rst
Doc/faq/library.rst
+10
-14
programming.rst
Doc/faq/programming.rst
+1
-1
No files found.
Doc/faq/library.rst
Dosyayı görüntüle @
d404fa6e
...
...
@@ -232,11 +232,9 @@ Threads
How do I program using threads?
-------------------------------
.. XXX it's _thread in py3k
Be sure to use the :mod:`threading` module and not the :mod:`thread` module.
Be sure to use the :mod:`threading` module and not the :mod:`_thread` module.
The :mod:`threading` module builds convenient abstractions on top of the
low-level primitives provided by the :mod:`thread` module.
low-level primitives provided by the :mod:`
_
thread` module.
Aahz has a set of slides from his threading tutorial that are helpful; see
http://starship.python.net/crew/aahz/OSCON2001/.
...
...
@@ -280,7 +278,7 @@ A simple fix is to add a tiny sleep to the start of the run function::
Instead of trying to guess how long a :func:`time.sleep` delay will be enough,
it's better to use some kind of semaphore mechanism. One idea is to use the
:mod:`
Q
ueue` module to create a queue object, let each thread append a token to
:mod:`
q
ueue` module to create a queue object, let each thread append a token to
the queue when it finishes, and let the main thread read as many tokens from the
queue as there are threads.
...
...
@@ -288,8 +286,8 @@ queue as there are threads.
How do I parcel out work among a bunch of worker threads?
---------------------------------------------------------
Use the :mod:`
Q
ueue` module to create a queue containing a list of jobs. The
:class:`~
Q
ueue.Queue` class maintains a list of objects with ``.put(obj)`` to
Use the :mod:`
q
ueue` module to create a queue containing a list of jobs. The
:class:`~
q
ueue.Queue` class maintains a list of objects with ``.put(obj)`` to
add an item to the queue and ``.get()`` to return an item. The class will take
care of the locking necessary to ensure that each job is handed out exactly
once.
...
...
@@ -777,11 +775,10 @@ Are there any interfaces to database packages in Python?
Yes.
.. XXX remove bsddb in py3k, fix other module names
Python 2.3 includes the :mod:`bsddb` package which provides an interface to the
BerkeleyDB library. Interfaces to disk-based hashes such as :mod:`DBM <dbm>`
and :mod:`GDBM <gdbm>` are also included with standard Python.
Interfaces to disk-based hashes such as :mod:`DBM <dbm.ndbm>` and :mod:`GDBM
<dbm.gnu>` are also included with standard Python. There is also the
:mod:`sqlite3` module, which provides a lightweight disk-based relational
database.
Support for most relational databases is available. See the
`DatabaseProgramming wiki page
...
...
@@ -794,8 +791,7 @@ How do you implement persistent objects in Python?
The :mod:`pickle` library module solves this in a very general way (though you
still can't store things like open files, sockets or windows), and the
:mod:`shelve` library module uses pickle and (g)dbm to create persistent
mappings containing arbitrary Python objects. For better performance, you can
use the :mod:`cPickle` module.
mappings containing arbitrary Python objects.
A more awkward way of doing things is to use pickle's little sister, marshal.
The :mod:`marshal` module provides very fast ways to store noncircular basic
...
...
Doc/faq/programming.rst
Dosyayı görüntüle @
d404fa6e
...
...
@@ -364,7 +364,7 @@ What are the "best practices" for using import in a module?
In general, don't use ``from modulename import *``. Doing so clutters the
importer's namespace. Some people avoid this idiom even with the few modules
that were designed to be imported in this manner. Modules designed in this
manner include :mod:`
T
kinter`, and :mod:`threading`.
manner include :mod:`
t
kinter`, and :mod:`threading`.
Import modules at the top of a file. Doing so makes it clear what other modules
your code requires and avoids questions of whether the module name is in scope.
...
...
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