Sponsored by us! Support us by visiting pythonbytes.fm/biz [courses] and pythonbytes.fm/pytest [book], or becoming a patron at patreon.com/pythonbytes
Brian #1: Meditations on the Zen of Python
- Moshe Zadka
- The Zen of Python is not "the rules of Python" or "guidelines of Python". It is full of contradiction and allusion. It is not intended to be followed: it is intended to be meditated upon.
- Moshe give some of his thoughts on the different lines of the Zen of Python.
- Full Zen of Python can be found here or in a REPL with
- A few
- Beautiful is better than ugly
- Consistency helps. So black, flake8, pylint are useful.
- “But even more important, only humans can judge what humans find beautiful. Code reviews and a collaborative approach to writing code are the only realistic way to build beautiful code. Listening to other people is an important skill in software development.”
- Complex is better than complicated.
- “When solving a hard problem, it is often the case that no simple solution will do. In that case, the most Pythonic strategy is to go "bottom-up." Build simple tools and combine them to solve the problem.”
- Readability counts
- “In the face of immense pressure to throw readability to the side and just "solve the problem," the Zen of Python reminds us: readability counts. Writing the code so it can be read is a form of compassion for yourself and others.”
Michael #2: nginx raided by Russian police
- Russian police have raided today the Moscow offices of NGINX, Inc., a subsidiary of F5 Networks and the company behind the internet's most popular web server technology.
- Russian search engine Rambler.ru claims full ownership of NGINX code.
- Rambler claims that Igor Sysoev developed NGINX while he was working as a system administrator for the company, hence they are the rightful owner of the project.
- Sysoev never denied creating NGINX while working at Rambler. In a 2012 interview, Sysoev claimed he developed NGINX in his free time and that Rambler wasn't even aware of it for years.
- Promptly following the event we took measures to ensure the security of our master software builds for NGINX, NGINX Plus, NGINX WAF and NGINX Unit—all of which are stored on servers outside of Russia. No other products are developed within Russia. F5 remains committed to innovating with NGINX, NGINX Plus, NGINX WAF and NGINX Unit, and we will continue to provide the best-in-class support you’ve come to expect.
Brian #3: I'm not feeling the async pressure
- Armin Ronacher
- “Async is all the rage.” But before you go there, make sure you understand flow control and back pressure.
- “…back pressure is resistance that opposes the flow of data through a system. Back pressure sounds quite negative … but it's here to save your day.”
- If parts of your system are async, you have to make sure the entire flow throw the system doesn’t have overflow points.
- An example shown with reader/writer that is way hairier than you’d think it should be.
- “New Footguns: async/await is great but it encourages writing stuff that will behave catastrophically when overloaded.”
- “So for you developers of async libraries here is a new year's resolution for you: give back pressure and flow control the importance they deserve in documentation and API.”
Michael #4: codetiming from Real Python
Brian #5: Making Python Programs Blazingly Fast
- Martin Heinz
- Seemed like a good followup to the last topic
- Profiling with
- command line
time python something.py
python -m cProfile -s time something.py
- timing functions with wrapper
timeit, but see that also, https://docs.python.org/3.8/library/timeit.html
- How to make things faster:
- use built in types over custom types
- caching/memoization with
- use local variables and local aliases when looping
- use functions… (kinda duh, but sure).
- don’t repeatedly access attributes in loops
- use f-strings over other formatting
- use generators. or at least experiment with them.
- the memory savings could result in speedup
Michael #6: LocalStack
- via Graham Williamson and Jan 'oglop' Gazda
- A fully functional local AWS cloud stack. Develop and test your cloud & Serverless apps offline!
- LocalStack spins up the following core Cloud APIs on your local machine:
- LocalStack builds on existing best-of-breed mocking/testing tools, most notably kinesalite/dynalite and moto. While these tools are awesome (!), they lack functionality for certain use cases. LocalStack combines the tools, makes them interoperable, and adds important missing functionality on top of them
- Has lots of config and knobs, but runs in docker so that helps
Joke: Types of software jobs.