1 Python Primer
This short primer collects the material that used to be a thirty-minute pre-reading session. It’s here for readers who are newer to programming or who want a quick refresher before the project chapters.
The aim isn’t to turn you into a Python semantics expert before you build anything. The aim is to give you enough footing that the first project chapters feel like security work rather that fighting for your development life. If something doesn’t make complete sense yet, that’s fine. Some of these ideas only really settle once you’ve used them a few times.
Use this primer to practise three habits that come up throughout the book:
- run small fragments in the interpreter before committing them to a script
- read errors as feedback from Python, not as a verdict on your ability
- prefer clear, boring code when a tool needs to be trusted under pressure
The primer moves from how Python runs code, through everyday style conventions, into the basic data types and string details that appear in the later networking examples. You don’t need to memorise every detail before moving on. Read it once, keep it nearby, and come back when a later chapter makes you wonder what the interpreter is doing under the hood.