#python

[ follow ]
Music
fromRaymondcamden
1 day ago

My Last Spotify Demo (this time I mean it - honest)

Built a personal Spotify Unwrapped using a Spotify data export, Python, and Astro, and planned mapping artists to genres without using the API.
Python
fromRealpython
1 day ago

Python Inner Functions: What Are They Good For? Quiz - Real Python

Inner functions enable encapsulation, closures retain captured state, nonlocal updates allow state mutation, and decorators extend callable behavior for reusable, maintainable code.
#pandas
Data science
fromTreehouse Blog
2 days ago

Beginning Data Analysis: From Questions to Insights

Learning data analysis enables beginners to turn raw information into meaningful insights, spot trends, and support evidence-based decision-making across many fields.
Software development
fromRealpython
2 days ago

Using Functional Programming in Python - Real Python

Python supports functional programming by treating functions as first-class citizens and by allowing anonymous functions via the lambda keyword.
#beginner-programming
Python
fromCaktusgroup
1 week ago

LLM Basics: Ollama Function Calling | Caktus Group

Use Ollama's local Llama 3.2 model to perform function calling by providing function schemas or Python functions and executing returned tool calls.
Python
fromTalkpython
1 week ago

Computer Science from Scratch

Rebuild computer science education to serve self-taught and nontraditional programmers by teaching core CS concepts through practical, career-relevant curricula.
Software development
fromRealpython
1 week ago

How to Use Google's Gemini CLI for AI Code Assistance - Real Python

Gemini CLI provides AI-powered code analysis, bug identification, and fix suggestions directly in the terminal with Google account authentication and Node.js/Python prerequisites.
Python
fromPycoders
1 week ago

PyCoder's Weekly | Issue #711

Python offers utilities for pairwise iteration and mocking, supports multi-agent orchestration with Temporal, and integrates with Claude Code and a new SQL Server Python driver.
Python
fromPythonmorsels
1 week ago

Wrapping text output in Python

Use Python's textwrap module to automatically wrap text to a specified width and render wrapped lines with wrap() or fill().
Django
fromdjangosnippets.org
1 week ago

Form field with fixed value

Create a custom Django ChoiceField subclass that enforces a single allowed value by setting choices to [(value, value)] in __init__.
fromMouse Vs Python
1 week ago

ANN: Vibe Coding Video Games with Python - Mouse Vs Python

Welcome to Vibe Coding Video Games with Python. In this book, you will learn how to use artificial intelligence to create mini-games. You will attempt to recreate the look and feel of various classic video games. The intention is not to violate copyright or anything of the sort, but instead to learn the limitations and the power of AI. Instead, you will simply be learning about whether or not you can use AI to help you know how to create video games.
Python
Python
fromTalkpython
1 week ago

Python apps with LLM building blocks

Treat LLMs as standard APIs in Python apps: create focused endpoints, use wrappers for caching/validation, monitor responses, and constrain outputs with types.
Python
fromInfoWorld
1 week ago

Python vs. Kotlin: Which loops do you like better?

Comparisons of Python and Kotlin reveal syntax and behavior differences; preview of Python 3.15 sampling profiler, AWS Zed AI editor, and AI/ML alternatives outside Python.
Software development
fromInfoQ
2 weeks ago

Aspire 13 Delivers Multi-Language Support and Significant Enhancements Across the Platform

Aspire 13 transforms Aspire into a polyglot application platform with first-class Python and JavaScript support alongside existing .NET capabilities.
fromPython GUIs
2 weeks ago

Getting Started With the NiceGUI Library in Python

To get the most out of this tutorial, you should have a basic knowledge of Python. Familiarity with general GUI programming concepts, such as event handling, widgets, and layouts, will also be beneficial. Installing NiceGUI Before using any third-party library like NiceGUI, you must install it in your working environment. Installing NiceGUI is as quick as running the python -m pip install nicegui command in your terminal or command line. This command will install the library from the Python Package Index (PyPI).
Web frameworks
Python
fromRealpython
2 weeks ago

How to Convert Bytes to Strings in Python - Real Python

Use Python's bytes.decode() with the correct character encoding to convert raw byte data from files, networks, or APIs into readable strings.
fromHoloViz Blog
2 weeks ago

Rich parameters & reactive programming with Param: 2.3 release - HoloViz Blog

Easily create classes with rich, declarative attributes - Parameter objects - that include extended metadata for various purposes such as runtime type and range validation, documentation strings, default values or factories, nullability, etc. In this sense, Param is conceptually similar to libraries like Pydantic, Python's dataclasses, or Traitlets. A suite of expressive and composable APIs for reactive programming, enabling automatic updates on attribute changes, and declaring complex reactive dependencies and expressions that can be introspected by other frameworks to implement their own reactive workflows.
Software development
Python
fromRealpython
2 weeks ago

How to Properly Indent Python Code - Real Python

Python uses indentation to define code blocks; follow PEP 8 by using four spaces per indentation level and rely on Python-aware editors.
Python
fromdaniel.feldroy.com
2 weeks ago

TIL: Default code block languages for mkdocs

Set default_lang: python in mkdocs.yml using pymdownx.highlight so code blocks without language tags are highlighted as Python.
#rust
fromTreyhunner
2 weeks ago

Python Morsels Lifetime Access Sale

When you sign up for Python Morsels, you'll choose your current Python skill level, from novice to advanced. Based on your skill level, each Monday I'll send you a personalized routine with: a short screencast to watch (or read) a multi-part exercise to move you outside your comfort zone a mini exercise that you can accomplish in just 10 minutes links to dive deeper into subsequent screencasts and exercises
Python
#mcp
fromRealpython
3 weeks ago
Python

Build a Python MCP Client to Test Servers From Your Terminal - Real Python

Build a minimal MCP client in Python to connect via stdio, list server capabilities, and use server tools with OpenAI for AI-powered chat.
fromTalkpython
1 month ago
Python

MCP Servers for Python Devs

Model Context Protocol (MCP) enables a single Python service to expose tools and data across editors and agents with practical transports and enterprise-grade authorization.
Python
fromRealpython
3 weeks ago

Build a Python MCP Client to Test Servers From Your Terminal Quiz - Real Python

Five-question quiz tests building a Python MCP client covering chat interface, AI handler initialization, runtime error handling, and command-line entry-point updates.
#dataclasses
Python
fromRealpython
3 weeks ago

Break Out of Loops With Python's break Keyword - Real Python

The break statement immediately exits the innermost loop, stopping further iterations; continue skips the current iteration but does not exit the loop.
fromMathspp
3 weeks ago

Floodfill algorithm in Python

ctx = canvas.getContext("2d") URL = "/blog/floodfill-algorithm-in-python/_python.txt" async def load_bitmap(url: str) -> list[list[int]]: # Fetch the text file from the URL response = await fetch(url) text = await response.text() bitmap: list[list[int]] = [] for line in text.splitlines(): line = line.strip() if not line: continue row = [int(ch) for ch in line if ch in "01"] if row: bitmap.append(row) return bitmap
Python
Python
fromMedium
1 month ago

How to activate virtual environment in python3

Use virtual environments to avoid pip 'externally-managed-environment' errors and prevent altering the system Python or other projects' dependencies.
Software development
fromEuroPython Society
3 weeks ago

Recognising Michael Foord as an Honorary EuroPython Society Fellow

Michael Foord was posthumously named an Honorary EuroPython Society Fellow for his technical contributions, community leadership, and enduring kindness.
Python
fromInfoWorld
3 weeks ago

Python vs. Mojo (and Java, Go, Rust, and .NET)

Mojo, alternative data-science languages, Python dataclasses, and a new PyTorch-related distributed-processing framework are current focal points for Python practitioners.
Fundraising
fromPython Software Foundation Blog
4 weeks ago

Python is for everyone: Join in the PSF year-end fundraiser & membership drive!

The PSF funds and supports Python's community and infrastructure through donations, memberships, events, and services to keep Python strong, sustainable, and inclusive.
Python
fromPythonmorsels
4 weeks ago

Unnecessary parentheses in Python

Parentheses in Python serve three roles—calling callables, creating empty tuples, and grouping—while grouping can be optional, misplaced, or enable implicit line continuation.
fromEfficient Coder
1 month ago

Tired of Pip and Venv? Meet UV, Your New All-in-One Python Tool | EfficientCoder

Well, I've been playing with a new tool that's been gaining a ton of steam, and honestly? I don't think I'm going back. It's called UV, and it comes from Astral, the same team behind the super-popular linter, ruff. The goal here is ambitious. UV wants to be the single tool that replaces pip, venv, pip-tools, and even pipx. It's an installer, an environment manager, and a tool runner all rolled into one. And because it's written in Rust, it's ridiculously fast.
fromdaniel.feldroy.com
4 weeks ago

Visiting Tokyo, Japan from November 12 to 24

I'm excited to announce that me and Audrey will be visiting Japan from November 12 to November 24, 2025! This will be our first time in Japan, and we can't wait to explore Tokyo. Yes, we'll be in Tokyo for most of it, near the Shinjuku area, working from coffee shops, meeting some colleagues, and exploring the city during our free time.
Python
Python
fromRealpython
4 weeks ago

Python Operators and Expressions - Real Python

Python operators enable computation and data manipulation using arithmetic, comparison, Boolean, identity, membership, bitwise, concatenation, repetition, and augmented assignment operators.
Web development
fromThe JetBrains Blog
1 month ago

10 Smart Performance Hacks For Faster Python Code | The PyCharm Blog

Optimize Python with efficient data structures, low-level techniques, profiling, and benchmarks to significantly reduce performance bottlenecks and speed execution.
fromTreehouse Blog
1 month ago

From Excel to Python: A Beginner's Guide

Excel gives you a huge toolbox of functions ( SUM, IF, VLOOKUP, INDEX, etc.), but eventually, you hit a wall. Maybe you want to do something more custom than Excel allows. Maybe your file slows down with too many rows. Or maybe there simply isn't a built-in function for exactly what you need. Python solves this by letting you build your own custom functions. That's why it's so powerful for data analysis-it's Excel without limits.
Python
Python
fromPythonmorsels
1 month ago

__slots__ for optimizing classes

Using __slots__ removes the per-instance __dict__, restricts allowed attributes, and improves memory usage and attribute access speed.
Python
fromMathspp
1 month ago

A generator, duck typing, and a branchless conditional walk into a bar

Generators provide lazy evaluation in Python, enabling iterable objects like range to create values on demand and avoid upfront computation.
#lazy-imports
Software development
fromRealpython
1 month ago

Building UIs in the Terminal With Python Textual - Real Python

Textual is a Python framework for building interactive, visually appealing, and efficient terminal-based user interfaces using widgets, layouts, styling, and events.
Python
fromPythontest
1 month ago

Polite lazy imports for Python package maintainers | PythonTest

Minimize package import time by lazily loading subcomponents via __init__.py so importing the package doesn't load unused parts.
Python
fromRealpython
1 month ago

Using Python Optional Arguments When Defining Functions Quiz - Real Python

Understand Python parameter handling: default values, mutable-default pitfalls, argument unpacking (*args/**kwargs), and using Boolean flags for clearer function calls.
fromTheregister
1 month ago

Python Foundation rejects $1.5M grant with no-DEI strings

These terms included affirming the statement that we 'do not, and will not during the term of this financial assistance award, operate any programs that advance or promote DEI [diversity, equity, and inclusion], or discriminatory equity ideology in violation of Federal anti-discrimination laws,' Crary noted.
Non-profit organizations
fromWill's Blog
1 month ago

Open Source Project Maintenance 2025

Every October, I do a maintenance pass on all my projects. At a minimum, that involves dropping support for whatever Python version is no longer supported and adding support for the most recently released Python version. While doing that, I go through the issue tracker, answer questions, and fix whatever I can fix. Then I release new versions. Then I think about which projects I should deprecate and figure out a deprecation plan for them.
Python
fromPythonmorsels
1 month ago

__dict__: where Python stores attributes

Python stores attributes for instances, classes, and modules in their __dict__ dictionaries, mapping attribute names to values.
fromThepythoncodingstack
1 month ago

And Now You Know Your ABC

Here's the task. I want to create a class to represent a track and field event held in a competition. This entry allows you to enter the raw results as reported by the officials-the athlete's bib number and the time they clocked in a race. It then computes the event's full results. There's more we could add to make this class more complete. But I won't. You can create a list of athletes that are competing in the track and field meeting:
Running
Python
fromThepythoncodingstack
1 month ago

Impostors * How Even The Python Docs Get This Wrong* * [Club]

zip(), enumerate(), and range() are common Python loop tools; mastering them enables exploring itertools, and examples of range() in for loops can be misleading.
fromRubyflow
1 month ago

Resolving the 'rest_framework' Module Not Found Error

The ModuleNotFoundError: No module named 'rest_framework' is a common issue faced by developers working with Django REST Framework (DRF).
fromRealpython
1 month ago

What Can I Do With Python? Quiz - Real Python

How well do you know the different areas where Python shines? In this quiz, you'll revisit web apps and APIs, GUI apps, CLI tools, machine learning, and more. You'll also check what Python isn't suited for and which alternatives work better. Get ready to explore the wide scope of what you can do with Python.
Python
Python
fromThepythoncodingstack
1 month ago

Are Tuples More Like Lists or Strings? And Why We Don't Really Care * [Club]

Choose Python data types based on semantic meaning and intended usage, not superficial similarity; tuples serve different roles than lists or strings in code design.
fromThepythoncodingstack
1 month ago

Creating a Singleton Class in Python And Why You (Probably) Don't Need It

If you spend long enough in the programming world, you'll come across the term singleton at some point. And if you hadn't seen this term yet, well, now you have! In Python, you don't need singleton classes. Almost never. But creating one is a great exercise in understanding how Python creates objects. And discussing alternatives to a singleton class helps you explore other aspects of Python.
Python
Books
fromTalkpython
1 month ago

Talk Python in Production Story

A decade-long website growth produced many features and users; a detailed account explains production lessons and how those differ from typical Python DevOps practices.
Python
fromRealpython
1 month ago

How to Use Python: Your First Steps - Real Python

Python installs on Windows, macOS, and Linux, offers a readable syntax, built-in data types, error handling, interactive REPL, and tools to start programming effectively.
Python
fromRealpython
1 month ago

How to Use Python: Your First Steps Quiz - Real Python

Practice Python fundamentals—variables, keywords, strings, and error recognition—through an eight-question, untimed quiz with scored feedback.
Python
fromMicrosoft for Python Developers Blog
2 months ago

Python in Visual Studio Code - October 2025 Release - Microsoft for Python Developers Blog

October 2025 Python extensions for VS Code add Python Environments fixes, Copy Test ID testing workflow, and shell startup improvements for environment activation.
Python
fromPeterbe
2 months ago

In Python, you have to specify the type and not rely on inference - Peterbe.com

TypeScript infers literal argument types causing compile-time errors for mismatched values; Python's mypy requires explicit annotations to report the same mismatches.
Software development
fromTalkpython
2 months ago

Data Sci Tips and Tricks from CodeCut.ai

Micro-sized, practical Python and data-science snippets plus modern tools and disciplined configuration accelerate reproducible workflows and reduce friction for day-to-day data work.
#functions
#ruff
Python
fromMathspp
2 months ago

TIL 134 - = alignment in string formatting

The '=' alignment puts the sign left and digits right; a leading zero width uses '=' and pads the number with zeros.
fromRealpython
2 months ago

Episode #268: Advice on Beginning to Learn Python - The Real Python Podcast

What's changed about learning Python over the last few years? What new techniques and updated advice should beginners have as they start their journey? This week on the show, Stephen Gruppetta and Martin Breuss return to discuss beginning to learn Python. We share techniques for finding motivation, building projects, and learning the fundamentals. We provide advice on installing Python and not obsessing over finding the perfect editor. We also examine incorporating LLMs into learning to code and practicing asking good questions.
Python
#animal-rescue
fromPythonmorsels
2 months ago

Why splitlines() instead of split("\n")?

Let's say we have some text that was retrieved from a database, and the original text came from a form submission in a web browser. Web browsers often represent line breaks as a carriage return character, followed by a line feed character: That's what we see in our text as well: \r followed by \n. This is often called CRLF (carriage return and line feed) whereas \n is called LF (line feed).
Python
Software development
fromZero To Mastery
2 months ago

[September 2025] Python Monthly Newsletter | Zero To Mastery

September 2025 Python updates highlight a new documentary, authoritative language rankings, type checker evaluations, feature flag guidance, and REPL customization in Python 3.14.
Python
fromBeauty-of-imagination
2 months ago

Abusing yahi -a log based statistic tool a la awstats- to plot histograms/date series from CSV

Yahi is a pip-installable Python module that builds a single static HTML page to aggregate and analyze logs (including CSV) using regex-based parsing and aggregations.
Artificial intelligence
fromNature
2 months ago

Python, the movie! The origin story of the programming language comes to the silver screen

NumPy standardized numeric array handling in Python, enabling scientific computing and AI and driving widespread adoption of Python for numerical and data-science libraries.
#machine-learning
Python
fromPycoders
2 months ago

PyCoder's Weekly | Issue #701

Multiple Python-related tools, events, and updates cover converting Python to LaTeX, MCP considerations, Playwright testing techniques, and recent Python and Django releases.
Python
fromRealpython
2 months ago

Strip Characters From a Python String - Real Python

Use Python's .strip(), .lstrip(), .rstrip() to remove whitespace or specified characters from string ends; use .removeprefix()/.removesuffix() for exact sequences.
Python
fromRealpython
2 months ago

Strip Characters From a Python String Quiz - Real Python

Use strip, lstrip, and rstrip to remove whitespace or specified characters from string ends and choose the appropriate method for the desired trimming.
Python
fromCreative Bloq
2 months ago

Think you've seen the weirdest place to play DOOM? Think again

DOOM can be run and played inside Blender by rendering the game to an icon using Doomviz and custom icon-scaling, caching, and input handling.
Web frameworks
fromRealpython
2 months ago

Get Started With FastAPI - Real Python

FastAPI provides a fast, developer-friendly Python web framework using type hints for automatic validation, serialization, interactive docs, and built-in features that reduce API boilerplate.
Python
fromThepythoncodingstack
2 months ago

The Networking Event (#4 in The itertools Series * `combinations()` and `permutations()`)

Generate round-robin one-to-one meeting rotas from a list of participant names for pairwise networking.
Python
fromRealpython
2 months ago

What Can You Do With Python? Quiz - Real Python

Python can be used across web development, CLIs, TUIs, GUIs, data work, and robotics, and learners can assess knowledge with an interactive quiz.
#repl
#type-hints
fromStreamHacker
2 months ago

Python Async Gather in Batches

Python's asyncio.gather function is great for I/O bound parallel processing. There's a simple utility function I like to use that I call gather_in_batches: async def gather_in_batches(tasks, batch_size=100, return_exceptions=False): for i in range(0, len(tasks), batch_size): batch = tasks[i:i+batch_size] for result in await asyncio.gather(*batch, return_exceptions=return_exceptions): yield result
Python
fromInfoWorld
2 months ago

Making good choices: How to get the best from Python tools

The way to get the best from Python, aka "the lingua franca of AI," is by knowing both its traps and its treasures.
Python
fromGrahamdumpleton
3 months ago

Status of wrapt (September 2025) - Graham Dumpleton

Back then, constructing decorators using function closures had various short comings and the resulting wrappers didn't preserve introspection and various other attributes associated with the wrapped function. Many of these issues have been resolved in updates to Python and the functools.wraps helper function, but wrapt based decorators were still useful for certain use cases such as being able to create a decorator where you could work out whether it was applied to a function, instance method, class method or even a class.
fromRealpython
3 months ago

Sorting Dictionaries in Python: Keys, Values, and More Quiz - Real Python

This quiz helps you practice sorting dictionaries by keys, values, and custom rules in modern Python. You'll revisit how insertion order works, when to use different views, and how to rebuild sorted dictionaries. You'll also learn best practices for sorting dictionaries efficiently. For a complete overview, check out Sorting Dictionaries: Keys, Values, and More. The quiz contains 11 questions and there is no time limit. You'll get 1 point for each correct answer.
Python
Python
fromRealpython
3 months ago

Python String Splitting - Real Python

Use Python's .split() to divide strings by whitespace or custom delimiters and control the number of splits with maxsplit; use re.split for regex patterns.
[ Load more ]