~/talk

Best Practices for Python Scripting

Talkat PyOhio 2015 · 2015-08-01..08-02· [developer-experience, python]
name:Greg Back
links:none on file
slides:none on file

Starts from a Python REPL solving "top 10 words" in the Gettysburg Address, then refactors the session into functions for retext, count_words and sort_words, uses collections.defaultdict and sorted with operator.itemgetter, adds argparse for infile/outfile and a count option, supports stdin/stdout, reads environment variables and config files via os.environ and ConfigParser, packages the script with setuptools entry_points as a console_scripts command, and ensures proper exit codes via sys.exit.

AI-written summary · about

  1. 0:00Start
  2. 2:49Collections Module
  3. 3:06Default Dictionary
  4. 14:42Pipe Data between Commands
  5. 24:14Environment Variables
  6. 24:35Environment Variable Parsing
  7. 30:25Fake Parser
  8. 35:37Using the Return Value from Program
  9. 38:40Entry Points
  10. 42:11Python Startup
  11. 42:30Read in History File
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.