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
745e48df
Kaydet (Commit)
745e48df
authored
Eyl 18, 2007
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
A bit of reordering, also show more subheadings in the lang ref index.
üst
2b03d45b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
43 deletions
+43
-43
index.rst
Doc/reference/index.rst
+1
-1
simple_stmts.rst
Doc/reference/simple_stmts.rst
+42
-42
No files found.
Doc/reference/index.rst
Dosyayı görüntüle @
745e48df
...
...
@@ -17,7 +17,7 @@ write a Python extension module, and the :ref:`c-api-index` describes the
interfaces available to C/C++ programmers in detail.
.. toctree::
:maxdepth:
2
:maxdepth:
3
introduction.rst
lexical_analysis.rst
...
...
Doc/reference/simple_stmts.rst
Dosyayı görüntüle @
745e48df
...
...
@@ -66,48 +66,6 @@ statements yielding ``None`` are not written, so that procedure calls do not
cause any output.)
.. _assert:
Assert statements
=================
.. index::
statement: assert
pair: debugging; assertions
Assert statements are a convenient way to insert debugging assertions into a
program:
.. productionlist::
assert_stmt: "assert" `expression` ["," `expression`]
The simple form, ``assert expression``, is equivalent to ::
if __debug__:
if not expression: raise AssertionError
The extended form, ``assert expression1, expression2``, is equivalent to ::
if __debug__:
if not expression1: raise AssertionError, expression2
.. index::
single: __debug__
exception: AssertionError
These equivalences assume that ``__debug__`` and :exc:`AssertionError` refer to
the built-in variables with those names. In the current implementation, the
built-in variable ``__debug__`` is ``True`` under normal circumstances,
``False`` when optimization is requested (command line option -O). The current
code generator emits no code for an assert statement when optimization is
requested at compile time. Note that it is unnecessary to include the source
code for the expression that failed in the error message; it will be displayed
as part of the stack trace.
Assignments to ``__debug__`` are illegal. The value for the built-in variable
is determined when the interpreter starts.
.. _assignment:
Assignment statements
...
...
@@ -308,6 +266,48 @@ instance variable. For example::
a.x += 1 # writes a.x as 4 leaving A.x as 3
.. _assert:
The :keyword:`assert` statement
===============================
.. index::
statement: assert
pair: debugging; assertions
Assert statements are a convenient way to insert debugging assertions into a
program:
.. productionlist::
assert_stmt: "assert" `expression` ["," `expression`]
The simple form, ``assert expression``, is equivalent to ::
if __debug__:
if not expression: raise AssertionError
The extended form, ``assert expression1, expression2``, is equivalent to ::
if __debug__:
if not expression1: raise AssertionError, expression2
.. index::
single: __debug__
exception: AssertionError
These equivalences assume that ``__debug__`` and :exc:`AssertionError` refer to
the built-in variables with those names. In the current implementation, the
built-in variable ``__debug__`` is ``True`` under normal circumstances,
``False`` when optimization is requested (command line option -O). The current
code generator emits no code for an assert statement when optimization is
requested at compile time. Note that it is unnecessary to include the source
code for the expression that failed in the error message; it will be displayed
as part of the stack trace.
Assignments to ``__debug__`` are illegal. The value for the built-in variable
is determined when the interpreter starts.
.. _pass:
The :keyword:`pass` statement
...
...
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