Message299359
A minor change. Complete the path by adding the other var-trace pairs and after checking carefully, I will be ready to push.
I prefer one easy to remember short-name function to two longer-named functions. However, the docstring should specify the tuple as idleConf config-type, section, and option names. Either *add* or *make_callback* could check len = 3 and callback[0] in idleConf.config_types, with a test added.
"changing the existing code seemed a little hackish": I don't understand exactly what you think is hackish.
There might be people who would prefer (possibly as less hakish)
def add(tkvar, parent, cb_info):
var = tkvar(parent)
if isinstance(callback, tuple):
callback = self.make_callback(var, cb_info)
else:
callback = cb_info
self.untraced.append((var, callback))
return var
I don't know if this would make the add calls readable, but is does factor the var calls into one place, replaces () with ',' (at the cost of passing one more reference), and avoids the hackish return of an input. It also simplifies the code in a way by making it 'flatter' instead of nested. Did I miss something? What do you think?
The parameter name change is an independent idea that should satisfy someone who objects to calling something an x that is not an x. |
|
Date |
User |
Action |
Args |
2017-07-28 03:45:31 | terry.reedy | set | recipients:
+ terry.reedy, cheryl.sabella |
2017-07-28 03:45:31 | terry.reedy | set | messageid: <1501213531.37.0.970286327339.issue30853@psf.upfronthosting.co.za> |
2017-07-28 03:45:31 | terry.reedy | link | issue30853 messages |
2017-07-28 03:45:30 | terry.reedy | create | |
|