---
# System prepended metadata

title: Augusto says

---

# Augusto says

* guys, please respect "Principle of least knowledge" or the ["Law of Demeter"](https://en.wikipedia.org/wiki/Law_of_Demeter) when writing code. This pretty much always makes code easier to reason about and to use
* also, please, please, don’t write code with partially initialized values. If the constructor was successful the class must be ready to perform all of its operations
  having to check if the object is initialized on every method is just too much unnecessary work, and it leaves room for tons of race conditions
* please avoid using `__getattr__` or `__getattribute__`, this breaks the linting tools since the attributes can not be determined statically anymore
* guys, please avoid adding functions that change behavior because of a flag
  by flag I mean, a bool, and Optional[T], the presence of a key in a dictionary. Usually the separate behavior can be decoupled to a new function that does just one thing.
* please, when using a lock, describe what the lock is protecting. It is very hard to infer that if the lock is just named lock and is used in multiple places
* guys, please, write [good commit messages](https://chris.beams.io/posts/git-commit/)
* guys, please try to make control flow simple. the more convoluted the control flow the longer it takes to understand a piece of code and it is so much easier for a bug to slip in.
Please, avoid using `else` branches for loops, deeply nested control flow, or deep class hierarchies that rely on polymorphism.
There are two very simple strategies, either exit early on, so the function will have multiple return statements, or keep a state variable and a single return at the end of the function.
Both ways will reduce the level of “nestedness” in a complex function.
* one more thing, please avoid using Optional[T] if T suffice, having something as optional just adds a lot of if statements that are unnecessary (e.g. the chain state being nullable, or a list that may not exist being nullable instead of just being empty)
* guys, please don’t monkey patch stuff
linting tools just don’t work with monkey patching, it is very annoying to fix these errors
inheritance can usually do the trick



## pylint
please note that disabling pylint warning per-line and per block are not the same thing:
https://pylint.readthedocs.io/en/latest/user_guide/message-control.html
either we want to have:
```
stmt  # pylint: disable=CODE
```
or
```
# pylint: disable=CODE
block
# pylint: enable=CODE
```
I don't think we ever want to do
```
# pylint: disable=CODE
stmt
```