On 18/04/19 8:53 AM, Larry Martell wrote:
On 2019-04-17 21:20, DL Neil wrote:
Do you bother with exception handling for import statements?

I often have to do something like this:

try:
     from settings import SITE_WAFER_DIAMETER
except ImportError:
     SITE_WAFER_DIAMETER = 300


That's an interesting application. Most of the multiple input configuration options examples (I've seen) start with a base of the least-prioritised values, and then 'add' higher-priority configuration option-values to that.

In this case we: import the config file, but if it's not available use the stated fall-back value(s).

Good one!
--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to