File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -555,10 +555,9 @@ A class definition defines a class object (see section :ref:`types`):
555555
556556.. productionlist ::
557557 classdef: [`decorators `] "class" `classname ` [`inheritance `] ":" `suite `
558- inheritance: "(" [`argument_list ` [","] ] ")"
558+ inheritance: "(" [`argument_list ` [","] | ` comprehension ` ] ")"
559559 classname: `identifier `
560560
561-
562561A class definition is an executable statement. The inheritance list usually
563562gives a list of base classes (see :ref: `metaclasses ` for more advanced uses), so
564563each item in the list should evaluate to a class object which allows
@@ -575,7 +574,7 @@ namespace.
575574
576575Class creation can be customized heavily using :ref: `metaclasses <metaclasses >`.
577576
578- Classes can also be decorated; as with functions, ::
577+ Classes can also be decorated: just like when decorating functions, ::
579578
580579 @f1(arg)
581580 @f2
@@ -586,6 +585,10 @@ is equivalent to ::
586585 class Foo: pass
587586 Foo = f1(arg)(f2(Foo))
588587
588+ The evaluation rules for the decorator expressions are the same as for function
589+ decorators. The result must be a class object, which is then bound to the class
590+ name.
591+
589592**Programmer's note: ** Variables defined in the class definition are class
590593attributes; they are shared by instances. Instance attributes can be set in a
591594method with ``self.name = value ``. Both class and instance attributes are
You can’t perform that action at this time.
0 commit comments