Closed stlehmann closed 9 years ago
My normal approach is to define the defaults in one go when creating the ConfigManager
(either on the init
call with defaults={'setting1':1, 'setting2':2}
or afterwards with ConfigManager.set_defaults({'setting1':1, 'setting2':2})
). This way you can set them all in one go, rather than when attaching the widgets.
Do you think it would still be useful to set them individually when attaching the handlers? I'm open to it (PR?) just not sure of the use case.
I prefer setting them at one go when defining my objects, their properties and their mapping. So I can see the object, it' s properties that I set and the mapping with default value one after each other. Though somebody else might see it different. Anyway I don' t see much harm in adding default
as an optional parameter. So everybody can choose which way to go. As you suggested I made a small PR for this.
Merged PR #11
It seems a bit clumsy to me to define the default values separately in a
set_default
function. Implementing adefault
parameter in theadd_handler()
function would be more convenient.