https://github.com/python/cpython/commit/774c7b1693b314919163c026a3e6521a78ca55a4
commit: 774c7b1693b314919163c026a3e6521a78ca55a4
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: hauntsaninja <[email protected]>
date: 2024-07-21T06:10:06Z
summary:

[3.13] gh-121977: Add tips for handling unhashable data (GH-122075) (#122076)

gh-121977: Add tips for handling unhashable data (GH-122075)
(cherry picked from commit ebc18abbf34ff248764bda1a02db7f1c783b71e3)

Co-authored-by: Raymond Hettinger <[email protected]>

files:
M Doc/library/statistics.rst

diff --git a/Doc/library/statistics.rst b/Doc/library/statistics.rst
index f7051ae2c80eb0..614f5b905a4a2e 100644
--- a/Doc/library/statistics.rst
+++ b/Doc/library/statistics.rst
@@ -485,6 +485,12 @@ However, for reading convenience, most of the examples 
show sorted sequences.
       >>> mode(["red", "blue", "blue", "red", "green", "red", "red"])
       'red'
 
+   Only hashable inputs are supported.  To handle type :class:`set`,
+   consider casting to :class:`frozenset`.  To handle type :class:`list`,
+   consider casting to :class:`tuple`.  For mixed or nested inputs, consider
+   using this slower quadratic algorithm that only depends on equality tests:
+   ``max(data, key=data.count)``.
+
    .. versionchanged:: 3.8
       Now handles multimodal datasets by returning the first mode encountered.
       Formerly, it raised :exc:`StatisticsError` when more than one mode was

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to