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
4f422e34
Kaydet (Commit)
4f422e34
authored
Haz 15, 2013
tarafından
Brett Cannon
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #17177: Update the programming FAQ to use importlib
üst
82b3d6ae
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
programming.rst
Doc/faq/programming.rst
+5
-5
No files found.
Doc/faq/programming.rst
Dosyayı görüntüle @
4f422e34
...
@@ -1738,12 +1738,12 @@ When I edit an imported module and reimport it, the changes don't show up. Why
...
@@ -1738,12 +1738,12 @@ When I edit an imported module and reimport it, the changes don't show up. Why
For reasons of efficiency as well as consistency, Python only reads the module
For reasons of efficiency as well as consistency, Python only reads the module
file on the first time a module is imported. If it didn't, in a program
file on the first time a module is imported. If it didn't, in a program
consisting of many modules where each one imports the same basic module, the
consisting of many modules where each one imports the same basic module, the
basic module would be parsed and re-parsed many times. To force rereading of a
basic module would be parsed and re-parsed many times. To force re
-
reading of a
changed module, do this::
changed module, do this::
import imp
import imp
ortlib
import modname
import modname
imp.reload(modname)
imp
ortlib
.reload(modname)
Warning: this technique is not 100% fool-proof. In particular, modules
Warning: this technique is not 100% fool-proof. In particular, modules
containing statements like ::
containing statements like ::
...
@@ -1755,10 +1755,10 @@ module contains class definitions, existing class instances will *not* be
...
@@ -1755,10 +1755,10 @@ module contains class definitions, existing class instances will *not* be
updated to use the new class definition. This can result in the following
updated to use the new class definition. This can result in the following
paradoxical behaviour:
paradoxical behaviour:
>>> import imp
>>> import imp
ortlib
>>> import cls
>>> import cls
>>> c = cls.C() # Create an instance of C
>>> c = cls.C() # Create an instance of C
>>> imp.reload(cls)
>>> imp
ortlib
.reload(cls)
<module 'cls' from 'cls.py'>
<module 'cls' from 'cls.py'>
>>> isinstance(c, cls.C) # isinstance is false?!?
>>> isinstance(c, cls.C) # isinstance is false?!?
False
False
...
...
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