Skip to main content
fix typo
Source Link
J_H
  • 42.2k
  • 3
  • 38
  • 157

DRY: Same wording is used for add_branch(). Maybe turn it into a docu reference to some common concept documentation. Maybe the CleanupMode docustringdocstring should bear responsibility for documenting this concept.

nit: "new isntance" typo in the add_branch() docstring, and apparently CTRL-V pasted at several other places.

DRY: Same wording is used for add_branch(). Maybe turn it into a docu reference to some common concept documentation. Maybe the CleanupMode docustring should bear responsibility for documenting this concept.

nit: "new isntance" in the add_branch() docstring.

DRY: Same wording is used for add_branch(). Maybe turn it into a docu reference to some common concept documentation. Maybe the CleanupMode docstring should bear responsibility for documenting this concept.

nit: "new isntance" typo in the add_branch() docstring, and apparently CTRL-V pasted at several other places.

added 456 characters in body
Source Link
J_H
  • 42.2k
  • 3
  • 38
  • 157

Testing set membership is a big deal, and should happen in O(1) constant time.

OK, good. Early python 3.X interpreters had “no promises” about ordering for set and dict. But nowadays we have an awesome internal data structure for dict, which is not only efficient but also makes promises related to insertion order. A dict with keys A, B, C pointing to None is a lot like a set() that contains A, B, C. Consider taking advantage of that.


Testing set membership is a big deal, and should happen in O(1) constant time.

OK, good. Early python 3.X interpreters had “no promises” about ordering for set and dict. But nowadays we have an awesome internal data structure for dict, which is not only efficient but also makes promises related to insertion order. A dict with keys A, B, C pointing to None is a lot like a set() that contains A, B, C. Consider taking advantage of that.

added 80 characters in body
Source Link
J_H
  • 42.2k
  • 3
  • 38
  • 157

Note that to_root() adheres to the conventional meaning of root being at top of tree, so that much is good. (Yeah, yeah, I know, computer science paints all trees upsidedown, whatever.)

And from src.weaktree.node import looks like the wrong thing. Prefer
Prefer from weaktree.node import. Adjust your path env var, or perhaps even your folder hierarchy, so it works.

Note that to_root() adheres to the conventional meaning of root being at top of tree, so that much is good.

And from src.weaktree.node import looks like the wrong thing. Prefer from weaktree.node import. Adjust your path env var, or perhaps even your folder hierarchy, so it works.

Note that to_root() adheres to the conventional meaning of root being at top of tree, so that much is good. (Yeah, yeah, I know, computer science paints all trees upsidedown, whatever.)

from src.weaktree.node import looks like the wrong thing. Prefer
from weaktree.node import. Adjust your path env var, or perhaps even your folder hierarchy, so it works.

added 800 characters in body
Source Link
J_H
  • 42.2k
  • 3
  • 38
  • 157
Loading
Source Link
J_H
  • 42.2k
  • 3
  • 38
  • 157
Loading