/pycon2016

Example code from the talk "Refactoring Python: Why and how to restructure your code" at PyCon 2016

Primary LanguageJupyter NotebookOtherNOASSERTION

Refactoring Python: Why and how to restructure your code

From the PyCon 2016 talk in Portland, OR (offical schedule link).

Slides are here (click image below to view):

Slides

Example code

Here are full Jupyter notebooks for each of the examples in the slides:

  • [Example 1: Extract Variable & Function](Extract Variable.ipynb)
  • [Example 2: Extract Class](Extract Class.ipynb)
  • [Example 3: Extract Closure](Extract Method.ipynb)

To run the example code (must have Python3 installed):

  1. Download this repo
  2. Go into the repo directory on your local machine
  3. pyvenv .
  4. source bin/activate
  5. pip3 install -r requirements.txt
  6. jupyter notebook
  7. Control-C to kill the notebook when you're done
  8. deactivate to leave the Python environment

License

The code within is released under the Apache 2.0 License.