This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients cheryl.sabella, terry.reedy
Date 2017-07-28.03:45:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1501213531.37.0.970286327339.issue30853@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2017-07-28 03:45:31terry.reedysetrecipients: + terry.reedy, cheryl.sabella
2017-07-28 03:45:31terry.reedysetmessageid: <1501213531.37.0.970286327339.issue30853@psf.upfronthosting.co.za>
2017-07-28 03:45:31terry.reedylinkissue30853 messages
2017-07-28 03:45:30terry.reedycreate