Skip to content

Instantly share code, notes, and snippets.

@gergob
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gergob/0f850c08256b6c219395 to your computer and use it in GitHub Desktop.
Save gergob/0f850c08256b6c219395 to your computer and use it in GitHub Desktop.
class Gadget:
"""A class used for modelling Gadgets in a web shop."""
__weight = 100
__operating_system = None
__battery_capacity = 2000
__screen_size = 1
def __init__(self, weight, operating_system, battery_capacity, screen_size):
self.__weight = weight
self.__operating_system = operating_system
self.__battery_capacity = battery_capacity
self.__screen_size = screen_size
def get_weight(self):
return self.__weight
def set_weight(self, weight):
self.__weight = weight
weight = property(get_weight, set_weight)
@property
def operating_system(self):
return self.__operating_system
@operating_system.setter
def operating_system(self, new_os):
self.__operating_system = new_os
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment