Mercurial > hg > config
diff python/bind.py @ 263:7b15ed0b372c
add a sample to bind to an instance, stub
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Fri, 15 Feb 2013 15:18:31 -0800 |
parents | |
children | efeb2cc78f30 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/python/bind.py Fri Feb 15 15:18:31 2013 -0800 @@ -0,0 +1,16 @@ +#!/usr/bin/env python + +""" +illlustrate e.g. method bind for python +""" + +class Foo(object): + + @classmethod + def create(cls): + """create an instance and bind a method onto foo""" + + + def foo(self): + print "Foo!" +