Hacker News new | past | comments | ask | show | jobs | submit login

"The following line of python code is able to simulate a Universal Turing Machine:"

    while len(word) > S : pIndex, word = (pIndex + 1) % len(C), word[1:] + C[pIndex] 
    if (word[0] == "1") else word[1:]



It's not obvious for a non-Pythonista, but the if .. else .. is meant to be on the previous line. It's a ternary conditional like cond?a:b in C (with the condition in the middle).


Yes, they should have broken the line before `word[1:]` so it was clearer.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: