Confusing object reference behaviour in recursion
Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Magical Minnie Puzzles
--
Chapters
00:00 Question
02:28 Accepted answer (Score 1)
02:53 Thank you
--
Full question
https://stackoverflow.com/questions/4718...
Question links:
[this]: https://stackoverflow.com/questions/4717.../
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #recursion
#avk47
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Magical Minnie Puzzles
--
Chapters
00:00 Question
02:28 Accepted answer (Score 1)
02:53 Thank you
--
Full question
https://stackoverflow.com/questions/4718...
Question links:
[this]: https://stackoverflow.com/questions/4717.../
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #recursion
#avk47
ACCEPTED ANSWER
Score 1
current_path = current_path[:-1] creates a new list, and binds the name current_path to this newly created list. At that stage, it is no longer the same list as result. Look at the list method pop() instead.