Skip to content

Instantly share code, notes, and snippets.

@grihabor
Last active November 1, 2017 07:41
Show Gist options
  • Save grihabor/439bd17343dd355e4f5b0ebaf89bee07 to your computer and use it in GitHub Desktop.
Save grihabor/439bd17343dd355e4f5b0ebaf89bee07 to your computer and use it in GitHub Desktop.
Create object instance with custom constructor #example
class Color:
def __init__(color, r, g, b):
color.r = r
color.g = g
color.b = b
white = Color(255, 255, 255)
print(white.r, white.g, white.b)
#|255 255 255
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment