Mercurial > hg > config
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 262:af52700d1ce0 | 263:7b15ed0b372c |
|---|---|
| 1 #!/usr/bin/env python | |
| 2 | |
| 3 """ | |
| 4 illlustrate e.g. method bind for python | |
| 5 """ | |
| 6 | |
| 7 class Foo(object): | |
| 8 | |
| 9 @classmethod | |
| 10 def create(cls): | |
| 11 """create an instance and bind a method onto foo""" | |
| 12 | |
| 13 | |
| 14 def foo(self): | |
| 15 print "Foo!" | |
| 16 |
