10000 Add "how to" for the setter Argument Clinic directive by corona10 · Pull Request #1245 · python/devguide · GitHub
[go: up one dir, main page]

Skip to content

Add "how to" for the setter Argument Clinic directive #1245

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Dec 13, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply suggestions from code review
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
  • Loading branch information
corona10 and erlend-aasland authored Dec 12, 2023
commit 031c5ebb3d4909e6463397be65c8f2d36a0c1348
4 changes: 1 addition & 3 deletions development-tools/clinic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2008,7 +2008,7 @@ How to declare PyGetSetDef functions
"Getters" and "setters" are C functions that facilitate property-like access for a class.
See :c:type:`getter <PyGetSetDef>` and :c:type:`setter <PyGetSetDef>` for details.
You can use the ``@getter`` and ``@setter`` directives to generate
"impl" functions for getters and setters in Argument Clinic.
"impl" functions for these.

This example --- taken from :cpy-file:`Modules/_io/textio.c` ---
shows the use of ``@getter`` and ``@setter`` in combination with
Expand Down Expand Up @@ -2053,8 +2053,6 @@ The generated glue code looks like this:
return return_value;
}

The implementation will then work the same as a Python method which is
decorated by :py:class:`property`.
.. note::

Getters and setters must be declared as separate functions.
Expand Down
0