From eba9d9ffe54de39ebceb07769d1151ac3d0f5e14 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Wed, 1 Mar 2017 01:15:36 +0900 Subject: [PATCH] Updated mistake in Python3/en tutorial (#2678) A fix on static method section (around line 728). Specifically, i.grunt() should raise an error since grunt() is a static method and 'i' is an instance of the class. --- python3.html.markdown | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/python3.html.markdown b/python3.html.markdown index b701d558..6a2a7ccd 100644 --- a/python3.html.markdown +++ b/python3.html.markdown @@ -724,8 +724,11 @@ if __name__ == '__main__': # Call the static method print(Human.grunt()) # => "*grunt*" - print(i.grunt()) # => "*grunt*" - + + # Cannot call static method with instance of object + # because i.grunt() will automatically put "self" (the object i) as an argument + print(i.grunt()) # => TypeError: grunt() takes 0 positional arguments but 1 was given + # Update the property for this instance i.age = 42 # Get the property