2
Day 1 lecture
j edited this page 2023-03-29 20:54:44 +02:00

Big picture:

  1. What's right for the people?
  2. Types represent what the people want. They must be correct. Only money should be money.
  3. Types must also be precise enough to do the job.
  4. You must keep their data secure, with trustable integrity.
diameter = 10
pi = 3.14159
length = diameter * pi

Reading notes:

Unicode characters are bad when it comes to input data, and must be filtered appropriately using tools like the unicodedata module. account_balance = "🐶" could take down a bank.

Note that python code is also data, and tricks like character encoding confusion can be used to hide code in third-party modules which the Python interpreter will happily execute.

Whitespace to describe block scope via indentation in Python is a clever way to take advantage of the brain's natural hardware to see blank areas, because in combination with movement, it uses that hardware to help you duck when something's coming toward you at high speed.