From 0161556dc295eb033820e0669e3a6df6a8250b9a Mon Sep 17 00:00:00 2001 From: Shreyan Avigyan Date: Sun, 2 May 2021 11:34:01 +0530 Subject: [PATCH 1/4] Update dataclasses.rst --- Doc/library/dataclasses.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Doc/library/dataclasses.rst b/Doc/library/dataclasses.rst index 87091ef819d8943..44521790c5c562c 100644 --- a/Doc/library/dataclasses.rst +++ b/Doc/library/dataclasses.rst @@ -168,6 +168,8 @@ Module-level decorators, classes, and functions ``__match_args__`` is already defined in the class, then ``__match_args__`` will not be generated. + .. versionadded:: 3.10 + - ``kw_only``: If true (the default value is ``False``), then all fields will be marked as keyword-only. If a field is marked as keyword-only, then the only affect is that the :meth:`__init__` @@ -177,11 +179,15 @@ Module-level decorators, classes, and functions :term:`parameter` glossary entry for details. Also see the ``dataclasses.KW_ONLY`` section. + .. versionadded:: 3.10 + - ``slots``: If true (the default is ``False``), :attr:`__slots__` attribute will be generated and new class will be returned instead of the original one. If :attr:`__slots__` is already defined in the class, then :exc:`TypeError` is raised. + .. versionadded:: 3.10 + ``field``\s may optionally specify a default value, using normal Python syntax:: From 9a0365ea6416d5f4a0caa8b66ff313a19b6136c5 Mon Sep 17 00:00:00 2001 From: Shreyan Avigyan Date: Sun, 2 May 2021 13:38:39 +0530 Subject: [PATCH 2/4] Update dataclasses.rst --- Doc/library/dataclasses.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Doc/library/dataclasses.rst b/Doc/library/dataclasses.rst index 44521790c5c562c..6c9b223664ae1a0 100644 --- a/Doc/library/dataclasses.rst +++ b/Doc/library/dataclasses.rst @@ -272,6 +272,8 @@ Module-level decorators, classes, and functions - ``kw_only``: If true, this field will be marked as keyword-only. This is used when the generated :meth:`__init__` method's parameters are computed. + + .. versionadded:: 3.10 If the default value of a field is specified by a call to :func:`field()`, then the class attribute for this field will be From 1cec977bfa5c886b1d5566571b3fff27a69c8d7e Mon Sep 17 00:00:00 2001 From: Shreyan Avigyan Date: Sun, 2 May 2021 14:01:29 +0530 Subject: [PATCH 3/4] Update dataclasses.rst --- Doc/library/dataclasses.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/dataclasses.rst b/Doc/library/dataclasses.rst index 6c9b223664ae1a0..95f3fa810c51afc 100644 --- a/Doc/library/dataclasses.rst +++ b/Doc/library/dataclasses.rst @@ -272,7 +272,7 @@ Module-level decorators, classes, and functions - ``kw_only``: If true, this field will be marked as keyword-only. This is used when the generated :meth:`__init__` method's parameters are computed. - + .. versionadded:: 3.10 If the default value of a field is specified by a call to From 6d58bd930e74c09885f3f6d24b6ab9e28ccbeb5b Mon Sep 17 00:00:00 2001 From: Shreyan Avigyan Date: Sun, 2 May 2021 14:28:54 +0530 Subject: [PATCH 4/4] Update dataclasses.rst --- Doc/library/dataclasses.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/dataclasses.rst b/Doc/library/dataclasses.rst index 95f3fa810c51afc..a27d09d0725deb4 100644 --- a/Doc/library/dataclasses.rst +++ b/Doc/library/dataclasses.rst @@ -272,7 +272,7 @@ Module-level decorators, classes, and functions - ``kw_only``: If true, this field will be marked as keyword-only. This is used when the generated :meth:`__init__` method's parameters are computed. - + .. versionadded:: 3.10 If the default value of a field is specified by a call to