The conventions used in this scrapbook
My intention when I started this scrapbook was to generate one code block and one short passage of text for each python idiom, function or tool, explaining what I am trying to do, map out my thoughts and provide links to useful resources.
Reference material is italicised. e.g Python in a Nutshell. Python functions and keywords are in bold e.g. def. Web addresses are active hyperlinks at the time of writing. I have tried to provide full credit to the original text, post or document that explains the most appropriate solution to the questions I propose.
All code is written in chunks with syntax highlighting. The code is annotated with comments which I try not to duplicate in text. Functions and Classes are given doc strings if appropriate. Python output is added to code chunks as comments. Debugging messages are given in redacted form, providing only the necessary lines to address the point in question.
Code chunk example:
def reverse_my_string(x):
"""Reverse all letters of a string"""
# the -1 is in the stride position of a splice operation
return x[::-1]
# run
reverse_my_string("bananas and apples")
# function call equivilent to "bananas and apples"[::-1]
# output
'selppa dna sananab'