On Wed, 15 Sep 2021 11:56:47 -0700, Mostowski Collapse wrote: > What could be slow, repeatedly requesting the "args" > field. Maybe I should do: > > help = term.args i = 0 while i < len(help) - 1: > ____mark_term(help[i]) > ____i += 1 term = help[i] > No this construct is a common error in new python programmers the next progression they make is when they discover the range function items = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0] for x in range(len(list)): print (items[x])
but that is equally inefficient the pythonic way is as previously suggested for item in items: print(item) then the management of the index is being handled by the python interpreter internally & is effectively machine code. every time you increment your own pointer the interpreter has to process reading the next line, reading the variable , incrementing it & then using it. this is what makes your current code slow. if you ever find your self creating a variable purely to use as a pointer into a list then you are almost certainly taking the wrong approach. more usefull links https://www.youtube.com/watch?v=zdJEYhA2AZQ -- "Show me a good loser, and I'll show you a loser." -- Vince Lombardi, football coach -- https://mail.python.org/mailman/listinfo/python-list