/Python

Upcoming Python Features Brought To You By Python Enhancement Proposals

- Martin Heinz tl;dr: In this article we will go over all the proposals that are going to bring some exciting new Python features. Martin covers the coming syntax changes, type annotations, debugging, and "quality of life" changes, adding support for parsing TOML format to Python's standard library.

featured in #295


When I'm Sad My Computer Sends Me Cats

- Andrew Healey tl;dr: "I split the emotions into good vs. bad to get a clearer read of my mood. The overall score swings between -1 (very bad) and 1 (very good). I don't want to be spammed with cats every time I itch my nose and trigger a frame of video that's interpreted as negative so I added a three-second trailing average to look for prolonged periods of negative emotion."

featured in #294


How We Optimized Python API Server Code 100x

- Vadim Markovtsev tl;dr: "Some of the tricks we used to speed up calls to our analytical API written in Python: played with asyncio, messed with SQLAlchemy, hacked deep in asyncpg, rewrote parts in Cython, found better data structures, replaced some pandas with pure numpy."

featured in #291


10 Unknown Security Pitfalls For Python

- Dennis Brinkrolf tl;dr: “We chose pitfalls that we believe are less known in the developer community:” (1) All assert statements are ignored when code is optimised. (2) MakeDirs permissions. (3) Absolute path joins, and more.

featured in #288


Strict Python Function Parameters

- Seth Michael Larson tl;dr: Seth is surprised how little he's seen this feature used, despite being included in Python 3.0, showing us the value of passing a parameter between the keyword-only and position-only parameters in the function signature.

featured in #285


Python Design Patterns

- Brandon Rhodes tl;dr: "My hope is that these pages make the patterns more discoverable — easier to find in web searches, and easier to read." Brandon covers design patterns in the following areas: Structural, Behavioral and Creational Patterns, as well as Python Specific and Inheritance Principles. 

featured in #284


Python Bytecode Explained

- Michael Moser tl;dr: "When a program is run, the python interpreter is first parsing your code and checking for any syntax errors, then it is translating the source code into a series of bytecode instructions; these bytecode instructions are then run by the python interpreter." Michael looks at the bytecode in loops, classes, function calls and more. 

featured in #283


Ultimate Guide To Text Similarity With Python

tl;dr: For humans, the 2 sentences "the bottle is empty" and "there is nothing in the bottle" mean the same thing despite being written in different formats. This post illustrates how we make an algorithm come to the same conclusion.

featured in #282


Python: Please Stop Screwing Over Linux Distros

- Drew DeVault tl;dr: "Everyone is frustrated with Python packaging. I call on the PSF to sit down for some serious, sober engineering work to fix this problem." Drew believes that Python packaging neglects the needs of Linux distros.

featured in #271


Peculiar Self-References

- Susam Pal tl;dr: The output of Susam's example shows simple Python code that create a self-referential list, although it's not obvious as to why, expecting the code to have failed with NameError. 

featured in #270