Skip to content

Commit 9355614

Browse files
author
Erlend E. Aasland
committed
Reword docs
1 parent cfc4d6f commit 9355614

File tree

2 files changed

+23
-18
lines changed

2 files changed

+23
-18
lines changed

Doc/includes/sqlite3/sumintwindow.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ def __init__(self):
77
self.count = 0
88

99
def step(self, value):
10-
"""This callback adds a row to the current window."""
10+
"""Adds a row to the current window."""
1111
self.count += value
1212

1313
def value(self):
14-
"""This callback returns the current value of the aggregate."""
14+
"""Returns the current value of the aggregate."""
1515
return self.count
1616

1717
def inverse(self, value):
18-
"""This callback removes a row from the current window."""
18+
"""Removes a row from the current window."""
1919
self.count -= value
2020

2121
def finalize(self):
22-
"""This callback returns the final value of the aggregate.
22+
"""Returns the final value of the aggregate.
2323
2424
Any clean-up actions should be placed here.
2525
"""

Doc/library/sqlite3.rst

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -475,20 +475,25 @@ Connection Objects
475475

476476
.. method:: create_window_function(name, num_params, aggregate_class, /)
477477

478-
Creates a user-defined aggregate window function. Aggregate window
479-
functions are supported by SQLite 3.25.0 and higher.
480-
:exc:`NotSupportedError` will be raised if used with older
481-
versions.
482-
483-
The aggregate class must implement ``step`` and ``inverse``
484-
methods, which accept the number of parameters *num_params* (if
485-
*num_params* is -1, the function may take any number of arguments),
486-
and ``finalize`` and ``value`` methods which return the final and
487-
the current result of the aggregate.
488-
489-
The ``finalize`` and ``value`` methods can return any of the types
490-
supported by SQLite: :class:`bytes`, :class:`str`, :class:`int`,
491-
:class:`float` and :const:`None`.
478+
Creates user-defined aggregate window function *name*.
479+
480+
*aggregate_class* must implement the following methods:
481+
482+
* ``step``: adds a row to the current window
483+
* ``value``: returns the current value of the aggregate
484+
* ``inverse``: removes a row from the current window
485+
* ``finalize``: returns the final value of the aggregate
486+
487+
``step`` and ``value`` accept *num_params* number of parameters,
488+
unless *num_params* is ``-1``, in which case they may take any number of
489+
arguments. ``finalize`` and ``value`` can return any of the types
490+
supported by SQLite:
491+
:class:`bytes`, :class:`str`, :class:`int`, :class:`float`, and
492+
:const:`None`. Call :meth:`create_window_function` with
493+
*aggregate_class* set to :const:`None` to clear window function *name*.
494+
495+
Aggregate window functions are supported by SQLite 3.25.0 and higher.
496+
:exc:`NotSupportedError` will be raised if used with older versions.
492497

493498
.. versionadded:: 3.11
494499

0 commit comments

Comments
 (0)