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
d51e842a
Kaydet (Commit)
d51e842a
authored
Mar 13, 2008
tarafından
Andrew M. Kuchling
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add class decorators
üst
2e25551e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletion
+8
-1
compound_stmts.rst
Doc/reference/compound_stmts.rst
+8
-1
No files found.
Doc/reference/compound_stmts.rst
Dosyayı görüntüle @
d51e842a
...
@@ -50,6 +50,7 @@ Summarizing:
...
@@ -50,6 +50,7 @@ Summarizing:
: | `with_stmt`
: | `with_stmt`
: | `funcdef`
: | `funcdef`
: | `classdef`
: | `classdef`
: | `decorated`
suite: `stmt_list` NEWLINE | NEWLINE INDENT `statement`+ DEDENT
suite: `stmt_list` NEWLINE | NEWLINE INDENT `statement`+ DEDENT
statement: `stmt_list` NEWLINE | `compound_stmt`
statement: `stmt_list` NEWLINE | `compound_stmt`
stmt_list: `simple_stmt` (";" `simple_stmt`)* [";"]
stmt_list: `simple_stmt` (";" `simple_stmt`)* [";"]
...
@@ -400,9 +401,10 @@ A function definition defines a user-defined function object (see section
...
@@ -400,9 +401,10 @@ A function definition defines a user-defined function object (see section
:ref:`types`):
:ref:`types`):
.. productionlist::
.. productionlist::
funcdef: [`decorators`] "def" `funcname` "(" [`parameter_list`] ")" ":" `suite`
decorated: decorators (classdef | funcdef)
decorators: `decorator`+
decorators: `decorator`+
decorator: "@" `dotted_name` ["(" [`argument_list` [","]] ")"] NEWLINE
decorator: "@" `dotted_name` ["(" [`argument_list` [","]] ")"] NEWLINE
funcdef: "def" `funcname` "(" [`parameter_list`] ")" ":" `suite`
dotted_name: `identifier` ("." `identifier`)*
dotted_name: `identifier` ("." `identifier`)*
parameter_list: (`defparameter` ",")*
parameter_list: (`defparameter` ",")*
: ( "*" `identifier` [, "**" `identifier`]
: ( "*" `identifier` [, "**" `identifier`]
...
@@ -529,6 +531,11 @@ mutable values there can lead to unexpected results. For :term:`new-style
...
@@ -529,6 +531,11 @@ mutable values there can lead to unexpected results. For :term:`new-style
class`\es, descriptors can be used to create instance variables with different
class`\es, descriptors can be used to create instance variables with different
implementation details.
implementation details.
Class definitions, like function definitions, may be wrapped by one or
more :term:`decorator` expressions. The evaluation rules for the
decorator expressions are the same as for functions. The result must
be a class object, which is then bound to the class name.
.. rubric:: Footnotes
.. rubric:: Footnotes
.. [#] The exception is propagated to the invocation stack only if there is no
.. [#] The exception is propagated to the invocation stack only if there is no
...
...
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