Skip to content

Instantly share code, notes, and snippets.

@bolerap
Created November 12, 2016 06:26
Show Gist options
  • Save bolerap/1b7c3d84dfd4b0242a9051dcacfb8627 to your computer and use it in GitHub Desktop.
Save bolerap/1b7c3d84dfd4b0242a9051dcacfb8627 to your computer and use it in GitHub Desktop.
# 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