MCPcopy Index your code
hub / github.com/python/cpython / tree

Function tree

Lib/turtledemo/tree.py:18–34  ·  view source on GitHub ↗

plist is list of pens l is length of branch a is half of the angle between 2 branches f is factor by which branch is shortened from level to level.

(plist, l, a, f)

Source from the content-addressed store, hash-verified

16from time import perf_counter as clock
17
18def tree(plist, l, a, f):
19 """ plist is list of pens
20 l is length of branch
21 a is half of the angle between 2 branches
22 f is factor by which branch is shortened
23 from level to level."""
24 if l > 3:
25 lst = []
26 for p in plist:
27 p.forward(l)
28 q = p.clone()
29 p.left(a)
30 q.right(a)
31 lst.append(p)
32 lst.append(q)
33 for x in tree(lst, l*f, a, f):
34 yield None
35
36def maketree():
37 p = Turtle()

Callers 1

maketreeFunction · 0.70

Calls 5

leftMethod · 0.80
rightMethod · 0.80
forwardMethod · 0.45
cloneMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…