Here is an example of what I mean:
Let’s say I have some ‘base’ package BaseError, which prints an error whenever print_error() is being called.
I also have a package Store, which uses BaseError to report errors.
Now I would like to create a package that depends on Store, but I would like to overwrite the functionality of print_error() that is supplied by BaseError in Store. Say, I would like that the error is emailed to me, instead of printed.
How would I go about implementing this?
Would making some kind of package WebStoreError that uses the same function handles as BaseError and include that in the package that depends on Store? Something like this:
package Store:
import BaseError as err
err.print_error()
package WebStore:
import Store
import WebStoreError as err
# Call some Store function that uses BaseError