Making Code Readable
Much like there are spaces in English sentences to make the words easier to read, we use spaces in Python code to make it easier to read. In particular, we always put a space before and after every binary operator. For example, we write v = 4 + -2.5 / 3.6 instead of v=4+-2.5/3.6. There are situations where it may not make a difference, but that’s a detail we don’t want to fuss about, so we always do it: it’s almost never harder to read if there are spaces.
Psychologists have discovered that people can keep track of only a handful of things at any one time (Forty Studies That Changed Psychology [Hoc04]). Since programs can get quite complicated, it’s important that you choose names for your variables that will help you ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access