public
Description: Toby's random stuff
Homepage: http://tobyho.com
Clone URL: git://github.com/airportyh/misc.git
airportyh (author)
Sun May 24 09:14:02 -0700 2009
commit  86d360ef5b449f4d2ceb795fbf6015341a82d491
tree    65699af3093726bffa9da75954d5de793e736821
parent  1530da2714cd70d69c3447633cbc61fdd5ffb3c9
misc / prototype.py / classy.py
100644 21 lines (17 sloc) 0.415 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from prototype import *
 
def Class(func):
  attrs = func()
  cls = constructor(attrs['init'])
  del attrs['init']
  cls.__name__ = func.__name__
  for name in attrs.keys():
    setattr(cls.prototype, name, attrs[name])
  return cls
  
@Class
def Show():
  def init(this, title):
    this.title = title
    this.personnel = []
  def addPersonnel(this, person):
    this.personnel.append(person)
  return locals()