Commit 9ef4a74b authored by Bryton Lacquement's avatar Bryton Lacquement 🚪

division_trace: add a comment about the transform method

parent a4857b78
......@@ -44,6 +44,15 @@ class FixDivisionTrace(BaseFix):
if child.type == lib2to3.pgen2.token.SLASH]
def transform(self, node, results):
# Transforming "a / b" into "division_traced(id, a, b) is fairly trivial.
# However, this is not the case when there are operations with the same
# priority as the division (i.e. division, multiplication) which are
# "in line", e.g.
# - "a / b / c"
# - "a * b / c * d / e"
# - ...
# That's why the logic is more complex here.
previous_node = None
for operator_pos in range(1, len(node.children), 2):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment