summaryrefslogtreecommitdiffstats
path: root/Doc/library/struct.rst
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/library/struct.rst')
-rw-r--r--Doc/library/struct.rst9
1 files changed, 9 insertions, 0 deletions
diff --git a/Doc/library/struct.rst b/Doc/library/struct.rst
index bee154f..ee949d9 100644
--- a/Doc/library/struct.rst
+++ b/Doc/library/struct.rst
@@ -119,6 +119,15 @@ Notes:
the platform C compiler supports C :ctype:`long long`, or, on Windows,
:ctype:`__int64`. They are always available in standard modes.
+(4)
+ When attempting to pack a non-integer using any of the integer conversion
+ codes, if the non-integer has a :meth:`__index__` method then that method is
+ called to convert the argument to an integer before packing.
+
+ .. versionchanged:: 3.2
+ Use of the :meth:`__index__` method for non-integers is new in 3.2.
+
+
A format character may be preceded by an integral repeat count. For example,
the format string ``'4h'`` means exactly the same as ``'hhhh'``.