Last active
April 22, 2020 11:20
-
-
Save ZhouYang1993/e038126c3362f209b3e10b1e80202294 to your computer and use it in GitHub Desktop.
Differences between Class Attribute and Instance Attribute of Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HandsomeGuy(object): | |
name = 'Yang' | |
def __init__(self, value): | |
self.name = value | |
guy = HandsomeGuy('Jack') | |
HandsomeGuy.name | |
# 'Yang' | |
guy.name | |
# 'Jack' | |
del guy.name | |
guy.name | |
# 'Yang' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment