def test0(): line() from overridee import aclass aclass.show(1, 2, 3) from overrider import aclass aclass.show(1, 2, 3) from overrider import _aclass_show _aclass_show(1, 2, 3) from overrider import aclass_show aclass_show(1, 2, 3)
def test1(): line() from overrider import aclass aclass.show(1, 2, 3) reload(overridee) # has no effects print 'overridee reloaded' aclass.show(1, 2, 3) from overridee import aclass aclass.show(1, 2, 3)
def test2(): line() from overridee import aclass aclass.show(1, 2, 3) from overrider import before print before aclass.show(1, 2, 3) from overrider import after # has no effects print after aclass.show(1, 2, 3)
#!/usr/bin/env python # encoding: utf-8 from overridee import aclass before = 'before' _aclass_show = aclass.show def aclass_show(a, b=0, c=None): if b > 0: print a, b else: _aclass_show(a, b, c) aclass.show = aclass_show after = 'after' if __name__ == '__main__': _aclass_show(1, -2) aclass.show(1, -2) _aclass_show(1, -2, 3) aclass.show(1, -2, 3) _aclass_show(1, 2) aclass.show(1, 2) _aclass_show(1, 2, 3) aclass.show(1, 2, 3)
from overridee import aclass _aclass_show = aclass.show def aclass_show(a, b=0, c=None): if b>0: print a, b else: _aclass_show(a, b) aclass.show = aclass_show something = 'something' if __name__ == '__main__': _aclass_show(1) _aclass_show(1, 2) _aclass_show(1, 2, 3) aclass.show(1) aclass.show(1, 2) aclass.show(1, 2, 3)