The hottest Python Substack posts right now

And their main takeaways
Category
Top Technology Topics
The Python Coding Stack • by Stephen Gruppetta 179 implied HN points 27 Oct 24
  1. In Python, each function has its own scope. This means a variable defined in a function can only be used inside that function, not outside.
  2. The LEGB rule helps Python find variables: it first looks in the Local scope, then in any Enclosing scopes, next in the Global scope, and finally in Built-in scope if it can't find the variable anywhere else.
  3. Namespaces are like containers for names in Python. They store the names of variables and their corresponding values, making it clear which variables are available in which parts of your code.
Laszlo’s Newsletter 27 implied HN points 02 Mar 25
  1. Dependency Injection helps organize code better. This makes your testing process simpler and more modular.
  2. Faking and spying in tests allow you to check if your code works without relying on external systems. It gives you more control over your testing!
  3. Using structured testing techniques reduces mental load. It helps you focus on writing clean tests instead of remembering complicated mocking syntax.
Bite code! 1957 implied HN points 11 Jan 25
  1. Using a Python virtual environment (venv) in Docker is a good practice, even though it's possible to skip it. It helps avoid conflicts when installing dependencies, keeping your project stable and organized.
  2. Even if your Docker image seems minimal, it's hard to maintain that state. Relying on the base image without a venv can lead to unexpected issues later on, especially as dependencies change.
  3. Using a venv simplifies your workflow and ensures consistency across different environments. It protects you from potential problems that arise when system packages interact with Python packages.
The Python Coding Stack • by Stephen Gruppetta 259 implied HN points 13 Oct 24
  1. In Python, lists don't actually hold the items themselves but instead hold references to those items. This means you can change what is in a list without changing the list itself.
  2. If you create a list by multiplying an existing list, all the elements will reference the same object instead of creating separate objects. This can lead to unexpected results, like altering one element affecting all the others.
  3. When dealing with immutable items, such as strings, it doesn't matter if references point to the same object. Since immutable objects cannot be changed, there are no issues with such references.
Bite code! 1957 implied HN points 15 Dec 24
  1. Using 'uv run' lets you run commands in a temporary environment without cluttering your main setup. This makes it easy to use big tools like Jupyter without installing them every time.
  2. The 'uvx' command works like 'npx', letting you test and run Python utilities quickly. It handles dependencies nicely, so you can focus on your tasks without worrying about setup.
  3. Creating scripts with 'uv init' helps you get started fast. It sets up everything you need, including project files and dependencies, making it easier to organize your Python projects.
Get a weekly roundup of the best Substack posts, by hacker news affinity:
Franz likes to code 39 implied HN points 05 Sep 24
  1. If you're having trouble with the Google Trends Python package, you can switch to using Wikipedia's page view statistics instead. It's a reliable and official way to get data on search trends.
  2. Wikipedia provides a rich API that allows you to fetch daily or hourly view counts for specific articles. This can help analyze how topics gain interest over time.
  3. You can use a simple Python code to find the page views for any Wikipedia article, making it easy to replace Google Trends in your research and get the data you need.
Bite code! 1467 implied HN points 03 Mar 24
  1. Redis is a powerful companion for Python, used for caching, sharing states, and creating queues.
  2. Redis is easy to use and highly efficient, widely employed in the industry for tasks like caching and inter-process communication.
  3. With basic features like lists, hashes, and sets, Redis has vast utility in tasks such as caches, queues, and inter-process communication.
Bite code! 1467 implied HN points 21 Jan 24
  1. Decorators provide syntactic sugar for code reuse of callback processing.
  2. Popular usages for decorators include intercepting calls, registering functions, and enriching function behavior.
  3. Decorators can be combined and used creatively to enhance your code, but be mindful not to overdo it.
Bite code! 1100 implied HN points 28 Feb 24
  1. Astral released a new Python package manager called uv, which aims to replace existing package and virtual env managers, with smartly integrated features and community contributions.
  2. Stand Alone Python project by indygreg compiles Python for various platforms, offering archives that can be run without installation, providing a consistent experience across different machines and platforms.
  3. A new lock file proposal by Brett Canon aims to tackle the challenge of pinned dependencies for Python projects, with previous attempts in 2021 and the latest proposal focusing on source distribution support and a new file format.
MOHAMMED JAMAL 204 HN points 12 May 24
  1. Lisp is a programming language known for treating code and data as interchangeable, a concept called homoiconicity, allowing for unique expression within the language.
  2. By translating Lisp expressions into Python constructs like function calls and lists, programmers can maintain the essence of Lisp in a more familiar syntax.
  3. Incorporating features like lambdas in Python, inspired by Lisp, provides the ability to define and call functions recursively, essential for creating Turing complete languages.
Bite code! 1100 implied HN points 15 Jan 24
  1. The splat operator ( ) in Python is used for unpacking function arguments and defining infinite (variadic) parameters.
  2. Differentiate between arguments and parameters in Python; parameters are defined variables in a function signature, while arguments are values passed to those parameters when calling the function.
  3. Positional and keyword arguments in Python allow passing arguments by position or by name in a function call.
Bite code! 856 implied HN points 30 Jan 24
  1. A new Python video game, JOY OF PROGRAMMING, is available on Steam for learning programming interactively.
  2. Pyodide, a Webassembly CPython port, now has experimental support from urllib3, enabling Python to run in the browser.
  3. Numpy 2 is set to release soon, with changes that may impact compatibility, so users should prepare by checking and updating dependencies.
Monthly Python Data Engineering 2 HN points 26 Sep 24
  1. A new free book called 'How Data Platforms Work' is being created for Python developers. It will explain the inner workings of data platforms in simple terms, with one chapter released each month.
  2. The Ibis library has removed the Pandas backend and now uses DuckDB, which is faster and has fewer dependencies. This change is expected to improve performance and usability.
  3. Several popular libraries in Python, such as GreatTables and Shiny, have released updates with new features and improvements, focusing on better usability and integration with modern technologies.
Mostly Python 524 implied HN points 22 Feb 24
  1. When creating a test suite, consider the constraints of your project and think about how to handle testing for non-traditional outputs like images or sound files.
  2. Use pytest to optimize your test suite by utilizing features like parametrization, fixtures, parallel test execution, and custom CLI arguments.
  3. An effective test suite should not only focus on passing tests but also consider failure scenarios, the need for assertions about test setup, and testing across platforms early on.
Mindful Modeler 1018 implied HN points 20 Dec 22
  1. Model predictions should consider uncertainty to make informed decisions. Decisions relying only on point predictions can be risky.
  2. Conformal prediction is a method that can provide rigorous uncertainty scores, giving probabilistic guarantees of covering the true outcome.
  3. Conformal prediction is simple to apply, often with just 3 lines of code. It is model-agnostic, distribution-free, and comes with coverage guarantees.
Data at Depth 79 implied HN points 03 May 24
  1. Python Streamlit is great for creating interactive maps from GIS point data, allowing for more engaging data storytelling.
  2. Interactive maps offer a better way to present data compared to static maps, enabling users to interact and explore the information further.
  3. Streamlit is a useful tool for creating interactive maps with user input functionalities, making it ideal for data visualization projects.
Data at Depth 79 implied HN points 26 Apr 24
  1. In data visualization, choosing the right chart is crucial to effectively communicate complex information in a clear and simple manner.
  2. Starting with techniques like small multiples, heat maps, and stacked area charts can help in learning how to select the right visualization for specific types of data.
  3. Experimenting with different visualization types and customizing them to the audience's needs can lead to impactful data storytelling.
Data at Depth 79 implied HN points 23 Apr 24
  1. GPT-4 can create choropleth and heatmaps from datasets if you know the right questions to ask
  2. Integrating GPT-4 into data visualization workflows can be beneficial for exploration and learning new libraries such as Python folium
  3. GPT-4 can be used to enhance code generation for data visualization projects by providing responses and solutions to specific coding challenges
Data Engineering Central 294 implied HN points 10 Apr 23
  1. Airflow has been a dominant tool for data orchestration, but new tools like Prefect and Mage are challenging its reign.
  2. Prefect focuses on using Python for defining tasks and workflows, but may not offer enough differentiation from Airflow.
  3. Mage stands out for its focus on engineering best practices and providing a smoother developer experience, making it a compelling choice over Airflow for scaling up data pipelines.
Data at Depth 59 implied HN points 13 May 24
  1. GPT-4 can be useful for generating data cleaning and visualization code in Python when combined with libraries like pandas and plotly
  2. Using GPT-4, you can learn how to clean datasets, create choropleth maps, and even animated choropleth maps to visualize data over time
  3. Interactive geospatial data visualizations that tell stories over time can be quickly created with Plotly by using GPT-4 prompts
Mostly Python 314 implied HN points 25 Jan 24
  1. The post discusses testing a game project, Alien Invasion, which may seem challenging to test at first.
  2. Testing the book's code against different versions of Python is important to identify bugs and incompatibilities.
  3. Using tools like pyenv to switch between Python versions can make testing with different versions easier.
Bite code! 733 implied HN points 09 May 23
  1. PDB is a basic but useful debugger that comes with Python by default, allowing you to pause programs, enter a debugging shell, and analyze program states.
  2. Learning to use PDB is valuable because it helps you understand debugging fundamentals, and knowing PDB can translate to using other debuggers as well.
  3. PDB offers various helpful commands like 'help', 'quit', 'list', 'next', 'continue', 'until line', 'jump line', 'display', 'step', 'return', 'up', and 'down' for effective debugging in Python.
Mindful Modeler 239 implied HN points 11 Jul 23
  1. SHAP values used in machine learning need to be estimated rather than calculated exactly, based on the concept of Shapley values from game theory.
  2. Estimating SHAP values is necessary due to the exponential increase in possible coalitions with a high number of features, requiring sampling techniques.
  3. The complexity of working with distributions in machine learning models necessitates the estimation of SHAP values using techniques like Monte Carlo integration.
Confessions of a Code Addict 293 HN points 06 Dec 23
  1. Each type in Python implements functions for the operators it supports and populates a function pointer table in its header.
  2. The CPython Virtual Machine calls a function in the abstract object interface based on the operator being executed.
  3. The abstract object interface performs function pointer table lookup in the object headers to call the right function for dynamic dispatch.
Data at Depth 39 implied HN points 16 May 24
  1. The author shares insights on their data analysis for the past 2 weeks, highlighting significant growth on Substack, experiences on Medium and LinkedIn, and struggles with Twitter-X.
  2. The author emphasizes the importance of taking time to read and detach from the pressure of creating content, as well as the value of ownership and direct engagement through Substack newsletters.
  3. A tutorial is provided on creating interactive Python Plotly dashboards for data visualizations, specifically focusing on a bubble map and bar chart to showcase data on global undernourishment.
Mindful Modeler 199 implied HN points 01 Aug 23
  1. SHAP can explain individual predictions and provide interpretations of average model behavior for any model type and data format.
  2. There's a need for a comprehensive guide like the book to navigate the evolving SHAP ecosystem with updated information and practical examples.
  3. The book dives into the theory, application, and various estimation methods of SHAP values, offering a one-stop resource for mastering machine learning model interpretability.
Mostly Python 628 implied HN points 30 Mar 23
  1. Copying a list in Python can lead to unexpected behavior if the items in the list are mutable objects.
  2. To create a true copy of a list with mutable objects, use the deepcopy() function from the copy module.
  3. When working with Python lists, consider the nature of the items in the list to decide between using list[:], list.copy(), or deepcopy().
Data at Depth 79 implied HN points 15 Feb 24
  1. Creating an interactive Python Plotly dashboard can help in deeper storytelling by combining data visuals like bubble charts and horizontal bar charts.
  2. Python's Plotly Dash framework allows developers to easily create web-based applications directly from Python code, without needing additional web development skills.
  3. By using the UN food security dataset, the tutorial demonstrates step-by-step how to load, filter, and visualize data, as well as set up dropdown menus for interactive exploration.
Data at Depth 79 implied HN points 28 Jan 24
  1. The value of data often lies in its comparability - Edward Tufte emphasizes this point in data visualization.
  2. Data visualization helps distill complex information into clear insights, especially with the abundance of data available today.
  3. Comparative analysis using tools like Python Plotly can enhance understanding and interpretation of data sets.
Data at Depth 79 implied HN points 20 Jan 24
  1. OpenAI's GPT-4 has a new tool that can analyze and interpret image data, including complex data visualizations.
  2. The image analysis tool from GPT-4 is capable of performing accurate analysis on intricate data representations.
  3. Consider becoming a subscriber to Data at Depth to get access to more insightful posts and to support the author's work.