Reading 2
Test-Driven Development
Write tests first! Then do the code!
- Test names should be specific, ie should return female when name is from female
- Test file and module should follow naming conventions ie module.py and test_module.py
- AAA! Arrange Act and Assert
The Cycle
- Write the test and make it fail. (There’s nothing to test yet!)
- Write the feature and make it pass.
- Refactor to make it nice.
What’s up with name == main ?
- When a script is being run, if the source file is being run directly “name” will be assigned “main”
- If it is a module that was imported, “name” will be assigned to “name”
Recursive Functions
First off: the reading 🤮 , the video: 💯
- Recursive functions are functions that call themselves
- In a recursive function, an evaluated variable such as n may not be evaluated until a base case is reached, then the previous iterations will be resolved based on the base case’s value. At that time they will be unloaded from the stack in the reverse order they were added to the stack.