+ 2
Python Oddity
Hello everyone.Recently I saw a website called "Python Oddity"(https://oswalpalash.com/python-oddity/ ) published by Palash Oswal .The oddities confused me a bit, especially the array part.I want to know why they behave so strange.Can someone give me a hand? https://code.sololearn.com/cE43go57U6v0/?ref=app
2 Answers
+ 2
Hm...after removing my prior answer for another day...this looks like an evaluation timing issue.
The anomaly seems to be only related to one of the a[a[0]]'s for the first assignment and related to both for the second.
I'm tempted to try decompiling it to bytecode if you want that sort of answer.