Mercurial > js4py
view source/jso.py @ 213:0ea90a1819c2 default tip
Custom theming
| author | Radomir Dopieralski <radomir.dopieralski@allegro.pl> |
|---|---|
| date | Wed, 27 Jun 2012 16:35:54 +0200 |
| parents | 4d70388df03e |
| children |
line wrap: on
line source
# class to represent JavaScript behavour, based on dict class Jso(dict): # Obj. & Obj[] are the same thing in JavaScript def __getitem__(self, key): return dict.get(self, key) __getattribute__ = __getitem__ __setattr__ = dict.__setitem__ __delattr__ = dict.__delitem__ j = Jso() j.a = 'a' j['b'] = 'b' print j
