Choosable dependency
Grant Edwards
grant.b.edwards at gmail.com
Sun Mar 7 21:59:41 EST 2021
On 2021-03-07, Manfred Lotz <ml_news at posteo.de> wrote:
> On Sat, 6 Mar 2021 15:40:41 -0000 (UTC)
> Grant Edwards <grant.b.edwards at gmail.com> wrote:
>
>> On 2021-03-06, Manfred Lotz <ml_news at posteo.de> wrote:
>> > Let us say I have a package which reads a TOML file.
>> >
>> > I want to give the user of my package the choice to decide if he
>> > wants to use the toml, tomlkit or rtoml package.
>>
>> Why would the user choose one over the other? Does the user get
>> different functions/features depending on which one they choose?
>
> I am a user of my package and I like to use rtoml which however is not
> available on another OS (due to Rust no being available there) where I
> also want to use my package. Here I can use toml which is always
> possible to install. Therefore, toml is the default so that the ordinary
> user doesn't need to care.
I still don't understand why the user needs to choose. Why not just use whichever one is installed?
Import whichever one you prefer, and if that fails, import one of the
others, if that fails, import the third one.
--
Grant
More information about the Python-list
mailing list