Skip to content

Instantly share code, notes, and snippets.

@LeMeteore
Created June 1, 2015 17:48
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 LeMeteore/73ce27f40346a42cd03c to your computer and use it in GitHub Desktop.
Save LeMeteore/73ce27f40346a42cd03c to your computer and use it in GitHub Desktop.
class MyClass:
@staticmethod
def the_static_method():
print("yeah")
@classmethod
def the_class_method(cls, x):
print("class: %s, arg x: %s" % (cls,x))
class Person:
name = ""
nickname = ""
def __init__(self, name="", nickname=""):
self.name = name
self.nickname = nickname
@classmethod
def from_string(cls, name_string):
name, nickname = name_string.split(',')
person = cls(name, nickname)
return person
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment