potato face
CryingPotato

Reading With Intent #

It’s always been easy for me to “get through” reading. You simply skim through the page, absorb a part of the material, and fumble your way around deep understanding, instead substituting it with words that sound like intelligence.

This is obviously a terrible strategy for deeply understanding anything, and many things have recently taught me that. One example was going through Reflections on Trusting Trust recently. Ken Thompson talks about quines early on, saying:

If you have never done this, I urge you to try it on your own.

Past me would have skimmed through for an answer, but now I opened up a terminal. The best I could come up with myself after 20 minutes was

with open('main.py') as f:
	print(''.join(f.readlines()))

On researching quines after this, I discovered that I had “cheated” by reading the file. When going through this I finally understood how one could produce a quine in Python: the key was understanding that repr prints the string with quotes. Writing partially from memory now:

data = ";print('data = ' + repr(data) + data)";print('data = ' + repr(data) + data)