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
383952d5
Kaydet (Commit)
383952d5
authored
Şub 01, 2014
tarafından
Mark Dickinson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #19683: Add __closure__ and other missing attributes to function docs.
üst
c82e27bf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
24 deletions
+30
-24
datamodel.rst
Doc/reference/datamodel.rst
+30
-24
No files found.
Doc/reference/datamodel.rst
Dosyayı görüntüle @
383952d5
...
...
@@ -486,44 +486,39 @@ Callable types
+-----------------------+-------------------------------+-----------+
| Attribute | Meaning | |
+=======================+===============================+===========+
| :attr:`
func_doc`
| The function's documentation | Writable |
|
| string, or ``None`` if | |
| | unavailable
| |
| :attr:`
__doc__`
| The function's documentation | Writable |
|
:attr:`func_doc`
| string, or ``None`` if | |
| | unavailable
.
| |
+-----------------------+-------------------------------+-----------+
| :attr:`__doc__` | Another way of spelling | Writable |
| | :attr:`func_doc` | |
+-----------------------+-------------------------------+-----------+
| :attr:`func_name` | The function's name | Writable |
+-----------------------+-------------------------------+-----------+
| :attr:`__name__` | Another way of spelling | Writable |
| | :attr:`func_name` | |
| :attr:`__name__` | The function's name. | Writable |
| :attr:`func_name` | | |
+-----------------------+-------------------------------+-----------+
| :attr:`__module__` | The name of the module the | Writable |
| | function was defined in, or | |
| | ``None`` if unavailable. | |
+-----------------------+-------------------------------+-----------+
| :attr:`
func_defaults`
| A tuple containing default | Writable |
|
| argument values for those | |
| :attr:`
__defaults__`
| A tuple containing default | Writable |
|
:attr:`func_defaults`
| argument values for those | |
| | arguments that have defaults, | |
| | or ``None`` if no arguments | |
| | have a default value
| |
| | have a default value
.
| |
+-----------------------+-------------------------------+-----------+
| :attr:`
func_code`
| The code object representing | Writable |
|
| the compiled function body. | |
| :attr:`
__code__`
| The code object representing | Writable |
|
:attr:`func_code`
| the compiled function body. | |
+-----------------------+-------------------------------+-----------+
| :attr:`
func_globals`
| A reference to the dictionary | Read-only |
|
| that holds the function's | |
| :attr:`
__globals__`
| A reference to the dictionary | Read-only |
|
:attr:`func_globals`
| that holds the function's | |
| | global variables --- the | |
| | global namespace of the | |
| | module in which the function | |
| | was defined. | |
+-----------------------+-------------------------------+-----------+
| :attr:`
func_dict`
| The namespace supporting | Writable |
|
| arbitrary function | |
| :attr:`
__dict__`
| The namespace supporting | Writable |
|
:attr:`func_dict`
| arbitrary function | |
| | attributes. | |
+-----------------------+-------------------------------+-----------+
| :attr:`
func_closure`
| ``None`` or a tuple of cells | Read-only |
|
| that contain bindings for the | |
| :attr:`
__closure__`
| ``None`` or a tuple of cells | Read-only |
|
:attr:`func_closure`
| that contain bindings for the | |
| | function's free variables. | |
+-----------------------+-------------------------------+-----------+
...
...
@@ -532,6 +527,12 @@ Callable types
.. versionchanged:: 2.4
``func_name`` is now writable.
.. versionchanged:: 2.6
The double-underscore attributes ``__closure__``, ``__code__``,
``__defaults__``, and ``__globals__`` were introduced as aliases for
the corresponding ``func_*`` attributes for forwards compatibility
with Python 3.
Function objects also support getting and setting arbitrary attributes, which
can be used, for example, to attach metadata to functions. Regular attribute
dot-notation is used to get and set such attributes. *Note that the current
...
...
@@ -542,16 +543,21 @@ Callable types
code object; see the description of internal types below.
.. index::
single: func_doc (function attribute)
single: __doc__ (function attribute)
single: __name__ (function attribute)
single: __module__ (function attribute)
single: __dict__ (function attribute)
single: __defaults__ (function attribute)
single: __code__ (function attribute)
single: __globals__ (function attribute)
single: __closure__ (function attribute)
single: func_doc (function attribute)
single: func_name (function attribute)
single: func_dict (function attribute)
single: func_defaults (function attribute)
single: func_closure (function attribute)
single: func_code (function attribute)
single: func_globals (function attribute)
single: func_
dict
(function attribute)
single: func_
closure
(function attribute)
pair: global; namespace
User-defined methods
...
...
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