[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Friday Filosofical Finking: Import protections

On 18/04/2019 17:10, Manolo Mart?nez wrote:
> On 2019-04-17, DL Neil <PythonList at DancesWithMice.info> wrote:
>>    2. When the program can still do something useful (if perhaps
>>       feature-limited) without the imported module by substituting
>>       something else in its place.
> Isn't this a very common scenario, similar to what package management systems
> call "optional dependencies"?

I wouldn't have said "very common."

> I maintain a small podcast aggregator that tags podcasts using an external
> tagging library as an optional dependency---people can choose not to install it
> if they don't care about tags. That library is imported within a try/except
> block.

Most imports I've seen have been for mandatory functionality; while my 
current code could run without its CRC library, everything it tried to 
talk to would reject its messages, for example!

Rhodri James *-* Kynesim Ltd