From 772b0ff37671b70dc0e8af6a0d37021fd0776ac0 Mon Sep 17 00:00:00 2001 From: jmauro <31569442+mauroalejandrojm@users.noreply.github.com> Date: Thu, 7 Apr 2022 23:37:03 -0500 Subject: [PATCH] Update classmethod.rst --- source/docs/functions/classmethod.rst | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/source/docs/functions/classmethod.rst b/source/docs/functions/classmethod.rst index 10c5b00..3d2331e 100644 --- a/source/docs/functions/classmethod.rst +++ b/source/docs/functions/classmethod.rst @@ -51,18 +51,18 @@ bar Example 2 ========= >>> #This example shows usage of decorator syntax which is recommended -class Line: - def __init__(self, length): - self.length = length - - @classmethod - def from_inches(cls, length_in): - length = float(length_in)*2.54 - return cls(length) - -l = Line.from_inches(3) -print l.length #returns 7.62 +>>> class Line: +... def __init__(self, length): +... self.length = length +... +... @classmethod +... def from_inches(cls, length_in): +... length = float(length_in)*2.54 +... return cls(length) +... +>>> l = Line.from_inches(3) +>>> print l.length #returns 7.62 See Also ======== -#TODO \ No newline at end of file +#TODO