Created
November 12, 2016 06:26
-
-
Save bolerap/1b7c3d84dfd4b0242a9051dcacfb8627 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# Define TV class, notice class is an object too | |
class TV(object): | |
def __init__(self, size) | |
self.size = size | |
# This is an instance method and it always bound to specific instance of TV class | |
def get_size(self): | |
return self.size | |
# Try to call class method | |
TV.get_size(TV(40)) | |
# or | |
TV(40).get_size() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment