Changes between Initial Version and Version 1 of Ticket #14666, comment 14


Ignore:
Timestamp:
04/11/16 19:42:16 (18 months ago)
Author:
darij
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #14666, comment 14

    initial v1  
    1 I've made some changes (NB: branch change!), particularly documenting one of the undocumented codepaths (namely, passing a dictionary for ``weight``). However, it exposed a bug: The algorithm assumes ``weight`` to be a function.
     1I've made some changes (NB: branch change!), particularly documenting one of the undocumented codepaths (namely, passing a dictionary for `weight`). However, it exposed a bug: The algorithm assumes `weight` to be a function.
    22
    3 My suggestion here would be to change the way dictionaries are handled. Rather than doing the try/excepts, I'd check whether ``weight`` is a dictionary, and then define a function ``weight_fun`` to send each ``e`` to ``weight[e]``. Otherwise, I'd just set ``weight_fun = weight``. All other uses of ``weight`` in the code should then be replaced by ``weight_fun``. Does this sound reasonable to you? (I haven't done any speed comparisons or other tests, so this might not actually be a good idea.)
     3My suggestion here would be to change the way dictionaries are handled. Rather than doing the `try/except`s, I'd check whether `weight` is a dictionary, and then define a function `weight_fun` to send each `e` to `weight[e]`. Otherwise, I'd just set `weight_fun = weight`. All other uses of `weight` in the code should then be replaced by `weight_fun`. Does this sound reasonable to you? (I haven't done any speed comparisons or other tests, so this might not actually be a good idea.)
    44
    55Also, the algorithm looks nice and clean. I haven't proven it yet. Is it easy or should I know something it follows from?