From 1fafc1a11f7d4799f252a40e608b0fd4d4fedb68 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Tue, 25 Oct 2011 00:03:51 -0400 Subject: document __bytes__ special method (closes #13259) --- Doc/reference/datamodel.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index 129f987..d01b1f2 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -1157,6 +1157,14 @@ Basic customization .. XXX what about subclasses of string? +.. method:: object.__bytes__(self) + + .. index:: builtin: bytes + + Called by :func:`bytes` to compute a byte-string representation of an + object. This should return a ``bytes`` object. + + .. method:: object.__format__(self, format_spec) .. index:: -- cgit v0.12