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
4f8fed28
Kaydet (Commit)
4f8fed28
authored
Eki 06, 2014
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
merge with 3.4
üst
92b47a4d
a94ad1e5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
18 deletions
+8
-18
programming.rst
Doc/faq/programming.rst
+2
-16
Makefile.pre.in
Makefile.pre.in
+6
-2
No files found.
Doc/faq/programming.rst
Dosyayı görüntüle @
4f8fed28
...
...
@@ -292,9 +292,8 @@ 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:`tkinter`, and :mod:`threading`.
importer's namespace, and makes it much harder for linters to detect undefined
names.
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.
...
...
@@ -308,11 +307,6 @@ It's good practice if you import modules in the following order:
directory) -- e.g. mx.DateTime, ZODB, PIL.Image, etc.
3. locally-developed modules
Never use relative package imports. If you're writing code that's in the
``package.sub.m1`` module and want to import ``package.sub.m2``, do not just
write ``from . import m2``, even though it's legal. Write ``from package.sub
import m2`` instead. See :pep:`328` for details.
It is sometimes necessary to move imports to a function or class to avoid
problems with circular imports. Gordon McMillan says:
...
...
@@ -343,14 +337,6 @@ module, but loading a module multiple times is virtually free, costing only a
couple of dictionary lookups. Even if the module name has gone out of scope,
the module is probably available in :data:`sys.modules`.
If only instances of a specific class use a module, then it is reasonable to
import the module in the class's ``__init__`` method and then assign the module
to an instance variable so that the module is always available (via that
instance variable) during the life of the object. Note that to delay an import
until the class is instantiated, the import must be inside a method. Putting
the import inside the class but outside of any method still causes the import to
occur when the module is initialized.
Why are default values shared between objects?
----------------------------------------------
...
...
Makefile.pre.in
Dosyayı görüntüle @
4f8fed28
...
...
@@ -343,7 +343,8 @@ AST_C= $(AST_C_DIR)/Python-ast.c
AST_ASDL
=
$(srcdir)
/Parser/Python.asdl
ASDLGEN_FILES
=
$(srcdir)
/Parser/asdl.py
$(srcdir)
/Parser/asdl_c.py
# XXX Note that a build now requires Python exist before the build starts
# Note that a build now requires Python to exist before the build starts.
# Use "hg touch" to fix up screwed up file mtimes in a checkout.
ASDLGEN
=
@ASDLGEN@
$(srcdir)
/Parser/asdl_c.py
##########################################################################
...
...
@@ -1509,7 +1510,10 @@ TAGS::
etags Include/
*
.h
;
\
for
i
in
$(SRCDIRS)
;
do
etags
-a
$$
i/
*
.[ch]
;
done
# Touch generated files
# This fixes up the mtimes of checked-in generated files, assuming that they
# only *appear* to be outdated because of checkout order.
# This is run while preparing a source release tarball, and can be run manually
# to avoid bootstrap issues.
touch
:
cd
$(srcdir)
;
\
hg
--config
extensions.touch
=
Tools/hg/hgtouch.py
touch
-v
...
...
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