Re: Using my routines as functions AND methods
[email protected] (Stefan Ram)
| Newsgroups | comp.lang.python |
|---|---|
| Organization | Stefan Ram |
| Message-ID | <[email protected]> |
Thomas Passin <[email protected]> writes: >def convert_method(f): You guys could also check out "MethodType" from "types". from types import * def f(): pass f.i = 0 def inc( f ): f.i += 1 f.inc = MethodType( inc, f ) f.inc() print( f.i ) .