Redo #313 on the correct branch. Declare success_indicator as a local variable, not a GLOBAL CONSTANT. * By convention, values that may change at runtime should not be in UPPERCASE. * A global variable can be read from either with or without a global statement * A global variable can be written to only when preceded by a global statement ```python >>> SUCCESS_INDICATOR = 0 >>> def read_from_global(): ... print(SUCCESS_INDICATOR) ... >>> def write_to_declared__global(): ... global SUCCESS_INDICATOR ... SUCCESS_INDICATOR += 1 ... >>> def write_to_undeclared__global(): ... SUCCESS_INDICATOR += 1 ... >>> read_from_global() 0 >>> write_to_declared__global() >>> read_from_global() 1 >>> write_to_undeclared__global() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<stdin>", line 2, in write_to_undeclared__global UnboundLocalError: local variable 'SUCCESS_INDICATOR' referenced before assignment ``` |
||
|---|---|---|
| .. | ||
| otreports | ||
| Hack-Bold.otf | ||
| Hack-Bold.ttf | ||
| Hack-BoldItalic.otf | ||
| Hack-BoldItalic.ttf | ||
| Hack-Italic.otf | ||
| Hack-Italic.ttf | ||
| Hack-Regular.otf | ||
| Hack-Regular.ttf | ||
| dev-versioner.py | ||
| font-tables.py | ||
| otmod.py | ||