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
ea75a513
Kaydet (Commit)
ea75a513
authored
Eki 20, 2016
tarafından
Yury Selivanov
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #26010: Document CO_* constants
üst
807e2f34
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
3 deletions
+58
-3
inspect.rst
Doc/library/inspect.rst
+58
-3
No files found.
Doc/library/inspect.rst
Dosyayı görüntüle @
ea75a513
...
...
@@ -152,9 +152,9 @@ attributes:
| | co_firstlineno | number of first line in |
| | | Python source code |
+-----------+-----------------+---------------------------+
| | co_flags | bitmap
: 1=optimized ``|``
|
| | |
2=newlocals ``|`` 4=\*arg
|
| | |
``|`` 8=\*\*arg
|
| | co_flags | bitmap
of ``CO_*`` flags,
|
| | |
read more :ref:`here
|
| | |
<inspect-module-co-flags>`
|
+-----------+-----------------+---------------------------+
| | co_lnotab | encoded mapping of line |
| | | numbers to bytecode |
...
...
@@ -1232,6 +1232,61 @@ updated as expected:
.. versionadded:: 3.5
.. _inspect-module-co-flags:
Code Objects Bit Flags
----------------------
Python code objects have a ``co_flags`` attribute, which is a bitmap of
the following flags:
.. data:: CO_NEWLOCALS
If set, a new dict will be created for the frame's ``f_locals`` when
the code object is executed.
.. data:: CO_VARARGS
The code object has a variable positional parameter (``*args``-like).
.. data:: CO_VARKEYWORDS
The code object has a variable keyword parameter (``**kwargs``-like).
.. data:: CO_GENERATOR
The flag is set when the code object is a generator function, i.e.
a generator object is returned when the code object is executed.
.. data:: CO_NOFREE
The flag is set if there are no free or cell variables.
.. data:: CO_COROUTINE
The flag is set when the code object is a coroutine function, i.e.
a coroutine object is returned when the code object is executed. See
:pep:`492` for more details.
.. versionadded:: 3.5
.. data:: CO_ITERABLE_COROUTINE
Used to turn generators into generator-based coroutines. Generator
objects with this flag can be used in ``await`` expression, and can
``yield from`` coroutine objects. See :pep:`492` for more details.
.. versionadded:: 3.5
.. note::
The flags are specific to CPython, and may not be defined in other
Python implementations. Furthermore, the flags are an implementation
detail, and can be removed or deprecated in future Python releases.
It's recommended to use public APIs from the :mod:`inspect` module
for any introspection needs.
.. _inspect-module-cli:
Command Line Interface
...
...
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