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
865d23d1
Kaydet (Commit)
865d23d1
authored
Nis 14, 2014
tarafından
R David Murray
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge: #15104: add backtick code markup.
üst
4d8eee97
fe0e1082
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
__main__.rst
Doc/library/__main__.rst
+7
-7
No files found.
Doc/library/__main__.rst
Dosyayı görüntüle @
865d23d1
...
...
@@ -5,19 +5,19 @@
.. module:: __main__
:synopsis: The environment where the top-level script is run.
'__main__'
is the name of the scope in which top-level code executes.
A module's __name__ is set equal to
'__main__'
when read from
``'__main__'``
is the name of the scope in which top-level code executes.
A module's __name__ is set equal to
``'__main__'``
when read from
standard input, a script, or from an interactive prompt.
A module can discover whether or not it is running in the main scope by
checking its own
__name__
, which allows a common idiom for conditionally
executing code in a module when it is run as a script or with `python
-m` but not when it is imported:
checking its own
``__name__``
, which allows a common idiom for conditionally
executing code in a module when it is run as a script or with `
`
python
-m`
`
but not when it is imported:
if __name__ == "__main__":
# execute only if run as a script
main()
For a package, the same effect can be achieved by including a
__main__.py
module, the contents of which will be executed when the
module is run with
-m
.
``__main__.py``
module, the contents of which will be executed when the
module is run with
``-m``
.
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