阅读背景:

如何正确处理python中的可选功能

来源:互联网 

I'm working on python packages that implement scientific models and I'm wondering what is the best way to handle optional features. Here's the behavior I'd like: If some optional dependencies can't be imported (plotting module on a headless machine for example), I'd like to disable the functions using these modules in my classes, warn the user if he tries to use them and all that without breaking the execution. so the following script would work in any cases:I'm working on python packages that implement s




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: