Is there a simple way to wrap a built-in function for the whole package?

jfong at ms4.hinet.net jfong at ms4.hinet.net
Wed Jul 31 22:16:05 EDT 2019


I get a package from Pypi. The package has many modules using built-in open() function. I like to redefine all the open() there with the default encoding 'utf-8', but not for code outside the package. Maybe I can put my def statement at the beginning of every module of this package, but just wondering is there a simple way of doing it?

Best Regards,
Jach



More information about the Python-list mailing list