Design: Idiom for classes and methods that are customizable by the user?
Dirk Bächle
tshortik at gmx.de
Thu May 12 18:42:17 EDT 2016
Hi Marko,
thank you very much for your quick reply.
On 13.05.2016 00:01, Marko Rauhamaa wrote:
>>
>> [...]
>>
>> - Is this a good approach
>
> As an approach, that looks ok. The code looks a bit too lenient, though,
> which can easily surprise and baffle the user. I think it would be
> better to fail:
>
> ========================================================================
> class AlreadyExistsError(Exception):
> pass
>
> [...]
>
Sure, I'll have exceptions in mind for the final implementation.
>
> [...]
>
> For example, why do you need a key? Couldn't you simply pass the task
> master class as an argument?
>
The idea behind this is, to be able to select classes by giving a parameter on the command-line. So at some point a translation from
a given "key" to its actual class has to happen, I guess.
Regards,
Dirk
More information about the Python-list
mailing list