#154 Code, frozen in carbon, on display for all
Python Bytes - Podcast tekijän mukaan Michael Kennedy and Brian Okken - Maanantaisin
Kategoriat:
Sponsored by Datadog: pythonbytes.fm/datadog
Special guest: Bob Belderbos
Brian #1: Lesser Known Coding Fonts
- Interesting examination of some coding fonts.
- Link to a great talk called Cracking the Code, by Jonathan David Ross, about coding fonts and Input.
I’m trying out Input Mono right now, and quite like it.
- Fira code: https://github.com/tonsky/FiraCode
Bob #2: Django Admin Handbook
- As a Django developer knowing the admin is pretty important.
- Free ebook of 40 or so pages, you can consume it in one evening.
- There are a lot of good tricks, 3 I liked:
- How to optimize queries in Django admin (override get_queryset)
- How to export CSV from Django admin (useful for data analysis in Jupyter for example)
- How to override save behaviour for Django admin (used this to notify users upon publishing a new exercise on our platform)
- Some more cool ebooks on that site, e.g. Tweetable #Python.
Michael #3: Your Guide to the CPython Source Code
- Let’s talk about exploring the CPython code
- You’ll want to get the code:
git clone https://github.com/python/cpython
- Compile the code (Anthony gives lots of steps for macOS, Windows, and Linux)
- Structure:
cpython/
│
├── Doc ← Source for the documentation
├── Grammar ← The computer-readable language definition
├── Include ← The C header files
├── Lib ← Standard library modules written in Python
├── Mac ← macOS support files
├── Misc ← Miscellaneous files
├── Modules ← Standard Library Modules written in C
├── Objects ← Core types and the object model
├── Parser ← The Python parser source code
├── PC ← Windows build support files
├── PCbuild ← Windows build support files for older Windows versions
├── Programs ← Source code for the python executable and other binaries
├── Python ← The CPython interpreter source code
└── Tools ← Standalone tools useful for building or extending Python
- Some cool “hidden” goodies. For example, check out
Lib/concurrent/futures/process.py
, it comes with a cool ascii diagram of the process. - Lots more covered, that we don’t have time for
- The Python Interpreter Process
- The CPython Compiler and Execution Loop
- Objects in CPython
- The CPython Standard Library
- Installing a custom version
Brian #4: Six Django template tags not often used in tutorials
- Here’s a few:
{% empty %}
, for use infor
loops when the array is empty{% lorem \[count\] [method] [random] %}
for automatically filling with Lorem Ipsum text.{% verbatim %} … {% endverbatim %}
, stop the rendering engine from trying to parse it and replace stuff.- https://hipsum.co/
Bob #5: Beautiful code snippets with Carbon
- Beautiful images, great for teaching Python / programming.
- Used by a lot of developer, nice example I spotted today.
- Supports typing and drag and drop, just generated this link by dropping a test module onto the canvas!
- Great to expand Twitter char limit (we use it to generate Python Tip images).
- Follow the project here, seems they now integrate with Github.
Michael #6: Researchers find bug in Python script may have affected hundreds of studies
- More info via Mike Driscoll at Thousands of Scientific Papers May be Invalid Due to Misunderstanding Python
- In a paper published October 8, researchers at the University of Hawaii found that a programming error in a set of Python scripts commonly used for computational analysis of chemistry data returned varying results based on which operating system they were run on.
- Scientists did not understand that Python’s glob.glob() does not return sorted results
- Throwing doubt on the results of more than 150 published chemistry studies.
- the researcher were trying to analyze results from an experiment involving cyanobacteria discovered significant variations in results run against the same nuclear magnetic resonance spectroscopy (NMR) data.
- The scripts, called the "Willoughby-Hoye" scripts after their creators, were found to return correct results on macOS Mavericks and Windows 10. But on macOS Mojave and Ubuntu, the results were off by nearly a full percent.
- The module depends on the operating system for the order in which the files are returned. And the results of the scripts' calculations are affected by the order in which the files are processed.
- The fix: A simple
list.sort()
! - Williams said he hopes the paper will get scientists to pay more attention to the computational side of experiments in the future.
Extras:
- Nov 5 is the next Python PDX West
- Using Big Tech Tools
Working on: PyBites platform: added flake8/ black code formatting, UI enhancements.
Michael:
- Bezos DDoS'd: Amazon Web Services' DNS systems knackered by hours-long cyber-attack
- PyPI Just Crossed the 200,000 Packages Threshold! (via RP)
- XKCD Date — via André Jaenisch, Enter https://explainxkcd.com/wiki/index.php/1425:_Tasks and learn, that it was published on 24th Sep 2014.
Joke:
- Q: What did the Network Administrator say when they caught a nasty virus?
- A: It hurts when IP