Overriding a function...

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Mon Jun 19 15:04:29 EDT 2006


In <1150742558.198061.239660 at p79g2000cwp.googlegroups.com>,
programmer.py at gmail.com wrote:

> 1) If mymodule is subsequently imported, will my `override' function be
> used, or will python magically `fix' (or break depending on your
> perspective) mymodule and use the original mymodule.test function?

It will not `fix` it.  Importing an already imported module doesn't reload
the module.

> 2) Once I assign mymodule.test with override, will modules that
> imported my module *PRIOR* to the assignment get override, or will they
> keep the original function test()?

They see the `override()` function.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list