Mercurial > hg > config
changeset 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 | 0afeb265da7f |
children | 0bc7c1a5eb83 |
files | python/aspects.py python/example/aspects.py |
diffstat | 2 files changed, 18 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/python/aspects.py Fri Oct 28 17:33:35 2016 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -class MakePythonLikeJavascript(object): - def __getattr__(self, name): - return undefined - -class undefined(MakePythonLikeJavascript): - def __nonzero__(self): - return False - def __str__(self): - return 'undefined' - __repr__ = __str__ -undefined = undefined() # singleton - -if __name__ == '__main__': - foo = MakePythonLikeJavascript() - foo.bar = 5 - print foo.bar - print foo.fleem - print foo.fleem.flarg
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/python/example/aspects.py Fri Oct 28 18:46:46 2016 -0700 @@ -0,0 +1,18 @@ +class MakePythonLikeJavascript(object): + def __getattr__(self, name): + return undefined + +class undefined(MakePythonLikeJavascript): + def __nonzero__(self): + return False + def __str__(self): + return 'undefined' + __repr__ = __str__ +undefined = undefined() # singleton + +if __name__ == '__main__': + foo = MakePythonLikeJavascript() + foo.bar = 5 + print foo.bar + print foo.fleem + print foo.fleem.flarg