From f4065d453d604ed59bdec1842503b686cb29e36b Mon Sep 17 00:00:00 2001
From: Vishal Pankaj Chandratreya <19171016+tfpf@users.noreply.github.com>
Date: Sat, 4 Oct 2025 15:14:44 +0530
Subject: [PATCH 1/3] Version bump [skip ci]
---
pyproject.toml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pyproject.toml b/pyproject.toml
index 9e330f2..1deed26 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -11,7 +11,7 @@ docs = ["furo~=2024.8", "myst-parser~=4.0"]
[project]
name = "pysorteddict"
-version = "0.11.0"
+version = "0.12.0"
authors = [
{name = "Vishal Pankaj Chandratreya"},
]
From 186967f4cdfe79a3dbca3feaf0c06371139eb000 Mon Sep 17 00:00:00 2001
From: Vishal Pankaj Chandratreya <19171016+tfpf@users.noreply.github.com>
Date: Sat, 4 Oct 2025 15:29:23 +0530
Subject: [PATCH 2/3] Skeleton [skip ci]
---
docs/changelog.md | 2 ++
docs/documentation.md | 1 +
2 files changed, 3 insertions(+)
diff --git a/docs/changelog.md b/docs/changelog.md
index 8f72edf..e3f587c 100644
--- a/docs/changelog.md
+++ b/docs/changelog.md
@@ -1,5 +1,7 @@
# Changelog
+## [0.12.0](https://github.com/tfpf/pysorteddict/compare/v0.11.0...v0.12.0)
+
## [0.11.0](https://github.com/tfpf/pysorteddict/compare/v0.10.0...v0.11.0)
diff --git a/docs/documentation.md b/docs/documentation.md
index 2ea6f73..8403899 100644
--- a/docs/documentation.md
+++ b/docs/documentation.md
@@ -4,6 +4,7 @@
Documentation of older versions is available on GitHub.
+▸ [0.11.0](https://github.com/tfpf/pysorteddict/blob/v0.11.0/docs/documentation.md)
▸ [0.10.0](https://github.com/tfpf/pysorteddict/blob/v0.10.0/docs/documentation.md)
▸ [0.9.0](https://github.com/tfpf/pysorteddict/blob/v0.9.0/docs/documentation.md)
▸ [0.8.2](https://github.com/tfpf/pysorteddict/blob/v0.8.2/docs/documentation.md)
From 0d4482131e7925f6a30de7f1f2d9ba4f12f559d9 Mon Sep 17 00:00:00 2001
From: Vishal Pankaj Chandratreya <19171016+tfpf@users.noreply.github.com>
Date: Sat, 4 Oct 2025 16:14:46 +0530
Subject: [PATCH 3/3] Add `reversed` documentation and examples
---
docs/changelog.md | 22 ++++++++++++++++
docs/documentation.md | 60 +++++++++++++++++++++++++++++++++++++++++--
2 files changed, 80 insertions(+), 2 deletions(-)
diff --git a/docs/changelog.md b/docs/changelog.md
index e3f587c..9f048ef 100644
--- a/docs/changelog.md
+++ b/docs/changelog.md
@@ -2,6 +2,28 @@
## [0.12.0](https://github.com/tfpf/pysorteddict/compare/v0.11.0...v0.12.0)
+
+ - #210 Define
+
SortedDictItems.__reversed__
. Define SortedDictItemsRevIter
as a reverse iterator over the
+ values of a sorted dictionary. Define SortedDictItemsRevIter.__next__
. Define
+ SortedDictKeys.__reversed__
and SortedDict.__reversed__
. Define
+ SortedDictKeysRevIter
as a reverse iterator over the keys of a sorted dictionary. Define
+ SortedDictKeysRevIter.__next__
. Define SortedDictValues.__reversed__
. Define
+ SortedDictValuesRevIter
as a reverse iterator over the values of a sorted dictionary. Define
+ SortedDictValuesRevIter.__next__
.
+
+
+
+ - #205 Add homepage build dependencies to project
+ metadata.
+
+
+
+ - #211 Rename
SortedDictItemsIter
to
+ SortedDictItemsFwdIter
, SortedDictKeysIter
to SortedDictKeysFwdIter
and
+ SortedDictValuesIter
to SortedDictValuesFwdIter
.
+
+
## [0.11.0](https://github.com/tfpf/pysorteddict/compare/v0.10.0...v0.11.0)
diff --git a/docs/documentation.md b/docs/documentation.md
index 8403899..4bc395c 100644
--- a/docs/documentation.md
+++ b/docs/documentation.md
@@ -453,7 +453,8 @@ Uncommenting the commented line runs any required destructors and makes this err
#### `iter(d)`
-Return an iterator over the keys in the sorted dictionary `d`. This is an efficient shorthand for `iter(d.keys())`.
+Return a forward iterator over the keys in the sorted dictionary `d`. This is an efficient shorthand for
+`iter(d.keys())`. Typical usage is to iterate directly over `d` instead of using this method.
```python
from pysorteddict import *
@@ -471,6 +472,27 @@ baz
foo
```
+#### `reversed(d)`
+
+Return a reverse iterator over the keys in the sorted dictionary `d`. This is an efficient shorthand for
+`reversed(d.keys())`.
+
+```python
+from pysorteddict import *
+d = SortedDict()
+d["foo"] = ()
+d["bar"] = [100]
+d["baz"] = 3.14
+for key in reversed(d):
+ print(key)
+```
+
+```text
+foo
+baz
+bar
+```
+
### Other Methods
#### `d.clear()`
@@ -820,7 +842,8 @@ bar eggs {}
#### `iter(v)`
-Return an iterator over the sorted dictionary view `v`.
+Return a forward iterator over the sorted dictionary view `v`. Typical usage is to iterate directly over `v` instead of
+using this method.
@@ -850,3 +873,36 @@ SortedDict({'a_bar': 'eggs', 'a_baz': 'eggs', 'bar': 'spam', 'baz': 'spam'})
Some modifications are prohibited, however. See [`del d[key]`](#del-dkey) and [`d.clear()`](#dclear) for details.
+
+#### `reversed(v)`
+
+Return a reverse iterator over the sorted dictionary view `v`.
+
+
+
+This method returns a mostly mutation-safe iterator.
+
+A sorted dictionary can be modified while iterating over any of its views. (Whether this is good practice is a separate
+question.)
+
+```python
+from pysorteddict import *
+d = SortedDict()
+d["foo"] = ()
+d["bar"] = [100]
+d["baz"] = 3.14
+for key in reversed(d.keys()):
+ d[key] = "spam"
+ d["z_" + key] = "eggs"
+ if "foo" in d:
+ del d["foo"]
+print(d)
+```
+
+```text
+segmentation fault (core dumped)
+```
+
+Some modifications are prohibited, however. See [`del d[key]`](#del-dkey) and [`d.clear()`](#dclear) for details.
+
+