codrill

Extract code exercises from code itself

Example uses:

```python from codrill import snippets_of_funcs import ut.util.uiter as m # find here: https://github.com/thorwhalen/ut/blob/master/util/uiter.py

for snippet in snippets_of_funcs(m, max_code_lines=4, max_doc_lines=30):
if not snippet.startswith(‘_’):

print(snippet) print()

```

To get random exercises:

```python from codrill import Exercises import more_itertools.more as m e = Exercises(m)

# and then repeatedly ask for random exercises. e.print_random_exercise() ```

This Exercises class is meant to be subclassed to include tracking of exercises presented, and possibly performance metrics (explicitly self-declared or inferred from a response). These statistics can then be used to chose the exercises not randomly, but so as to optimize learning.