Here is the full python program on pastebin https://pastebin.com/0syTHsJX
,I dont understand how the variable assigned to the function mutable_link() works. if i replace s with mutable_link
for element in reversed(source): mutable_link()('push_first', element) return mutable_link()
Here is the version that works though.
s = mutable_link() for element in reversed(source): s('push_first', element) return s
How does assigning the function to variables work and why do i get error when i use just mutable_link() instead.
Advertisement
Answer
I see your code and found that.
In the first case
mutable_link()
call again and again and then set thecontents
value to'empty'
.But in the second case
mutable_link()
call only once and does not change thecontents
again and again.