Mercurial > hg > config
comparison python/example/aspects.py @ 811:0fffb3560641
not sure if we need this but we will keep it for now
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Fri, 28 Oct 2016 18:46:46 -0700 |
parents | python/aspects.py@2f0baf81372f |
children |
comparison
equal
deleted
inserted
replaced
810:0afeb265da7f | 811:0fffb3560641 |
---|---|
1 class MakePythonLikeJavascript(object): | |
2 def __getattr__(self, name): | |
3 return undefined | |
4 | |
5 class undefined(MakePythonLikeJavascript): | |
6 def __nonzero__(self): | |
7 return False | |
8 def __str__(self): | |
9 return 'undefined' | |
10 __repr__ = __str__ | |
11 undefined = undefined() # singleton | |
12 | |
13 if __name__ == '__main__': | |
14 foo = MakePythonLikeJavascript() | |
15 foo.bar = 5 | |
16 print foo.bar | |
17 print foo.fleem | |
18 print foo.fleem.flarg |