diff options
author | Adam Bard <github@adambard.com> | 2020-10-01 07:54:28 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-01 07:54:28 -0700 |
commit | b98a2f56ae9f7fa211a8143f8ae5a0305562fcaa (patch) | |
tree | d723d4f9b387f64c78e5693bfa16abb494f8e350 | |
parent | c35670808e8bbf734bea5c2aa2fd280342f40b17 (diff) | |
parent | 141eaec78c00a71630261a25b02306dc113c83af (diff) |
Merge pull request #4022 from angelorohit/master
[python/en] Update class example on invoking static methods from clas…
-rw-r--r-- | python.html.markdown | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/python.html.markdown b/python.html.markdown index 27b2b22a..2fc266eb 100644 --- a/python.html.markdown +++ b/python.html.markdown @@ -773,9 +773,8 @@ if __name__ == '__main__': # Call the static method print(Human.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 + # Static methods can be called by instances too + print(i.grunt()) # => "*grunt*" # Update the property for this instance i.age = 42 |