API for custom Unicode error handlers

Serhiy Storchaka storchaka at gmail.com
Fri Oct 4 15:08:50 EDT 2013


04.10.13 20:22, Chris Angelico написав(ла):
> I'd be quite happy with importing having a side-effect here. If you
> import a module that implements a numeric type, it should immediately
> register itself with the Numeric ABC, right? This is IMO equivalent to
> that.

There is a difference. You can't use a numeric type without importing a 
module, but you can use error handler registered outside of your module.

This leads to subtle bugs. Let the A module imports error_handlers and 
uses error handle. The module B uses error handle but doesn't import 
error_handlers. C.py imports A and B and all works. D.py imports B and A 
and fails.





More information about the Python-list mailing list