首页›发现›编程›Real Python

Real Python

Atom运行正常
访问网站
文章数56
更新频率每周约 4.8 篇
最近抓取9分钟前
订阅方式Atom
订阅地址https://realpython.com/atom.xml

最近的文章

订阅后,这些文章和以后的新文章都会出现在你的阅读器里

GLM 5.4 Draws a Python Reading a Book

AI 摘要Real Python ran GLM 5.4 through an informal five-task benchmark of everyday Python skills, including using the turtle module to draw a python reading a book, which the model completed successfully with 172 lines of code. Across the tasks, the model wrote Python at a 3.10 level with some 3.11 features, avoided all ten unrelated edits in a cleanup test, correctly identified that itertools.flatten() doesn't exist, and cost $0.16 total. The full results are available on Real Python's website as part of their ongoing AI benchmark series.

Amazon Ergo Draws a Python Reading a Book

AI 摘要This article presents Real Python's informal AI benchmark of Amazon Ergo, which was tasked with drawing a python reading a book using Python's turtle module. Across five tasks, the model drew the snake with 3,205 drawing commands, used modern Python 3.11 features, correctly flagged that itertools.flatten() doesn't exist, and made zero unnecessary edits to a script. The full run took about 2.5 minutes and cost $0.18, with the model reporting Python 3.15.1 as the newest release.

Quiz: Build an AI Agent From Scratch in Python: The Agentic Loop

AI 摘要This article introduces a quiz that tests comprehension of a tutorial on building an AI agent from scratch in Python. The quiz revisits core concepts that turn a language model into an agent, including the harness, the conversation context, the tools the model can request, and the agentic loop that chains tool calls until an answer is reached.

Python Microservices With gRPC

AI 摘要This tutorial teaches readers how to implement Python microservices that communicate with each other using gRPC, explaining why splitting a monolithic application into independently deployed services offers benefits like modularity, flexibility, and robustness. It covers building middleware for monitoring, performing unit and integration tests, and deploying microservices to a production environment with Kubernetes, using a web app and a Recommendations microservice as a running example.

Plotting Declarative Charts With Altair

AI 摘要The article introduces Altair, a declarative Python visualization library where users describe what their data means—such as which columns map to axes, colors, and interactivity—and the library generates the chart, unlike Matplotlib's approach of scripting every visual detail. Altair produces web-native charts (HTML and JavaScript) that render in notebooks and can be saved as standalone files or embedded in web pages, making it ideal for interactive exploratory analysis. It's not a replacement for Matplotlib, which remains the better choice for pixel-precise publication figures or 3D plots, so the two libraries serve complementary use cases.

Step 5 Draws a Python Reading a Book

AI 摘要Real Python's informal AI benchmark asked the Step 5 model to write a turtle program drawing a python reading a book, but the 253-line script failed with an AttributeError and produced zero drawing commands. Across the five tasks, the model scored at Python 3.10 for modernity, passed 7 of 12 modern idiom checkpoints, correctly caught the nonexistent itertools.flatten() function, and made 1 of 10 possible unrelated edits. The full run cost $0.15, used about 49.4k thinking tokens, and took roughly 6 minutes 44 seconds.

Quiz: Using Python for Data Analysis

AI 摘要This article introduces a quiz designed to test knowledge from the video course 'Using Python for Data Analysis.' The quiz covers the stages of a data analysis workflow, handling data issues like missing values, wrong data types, out-of-range values, and duplicates using pandas, and fitting a linear regression model with scikit-learn.

Generating Python Tests With AI: A Suite You Can Trust

AI 摘要This Real Python tutorial presents a reusable workflow for using AI coding agents like Claude Code to generate a trustworthy pytest suite for projects with little or no existing tests. It covers setting up testing conventions in a CLAUDE.md file, documenting intended behavior in a behavior table, generating tests to meet a 95% branch coverage goal, and validating quality through review and mutation testing with mutmut. The guide emphasizes that assertions must reflect intended behavior rather than current behavior, and that a suite that passes without catching real bugs is worse than no suite at all.

Quiz: Generating Python Tests With AI: A Suite You Can Trust

AI 摘要This article introduces a quiz that tests your understanding of generating Python tests with AI. It covers key topics such as how testing conventions guide AI coding agents, reviewing behavior tables before generating tests, testing both sides of a boundary, and spotting red flags in AI-generated tests. It also highlights how branch coverage and mutation testing with mutmut help verify that your test suite is reliable.

Quiz: What Are Python Wheels and Why Should You Care?

AI 摘要This article introduces a quiz that tests your knowledge of Python wheels and their benefits. It covers how wheels compare to source distributions, how to interpret wheel filename tags, and how to instruct pip on which formats to install. It also touches on building platform-specific and manylinux wheels that function across multiple systems.

Quiz: What Are Python Asterisk and Slash Special Parameters For?

AI 摘要This article announces a quiz that tests your understanding of Python's asterisk (*) and slash (/) special parameters in function definitions. By working through the quiz, you revisit how these symbols split a function's parameters into positional-only, positional-or-keyword, and keyword-only groups. It also covers how they relate to *args and how they help keep functions backward compatible.

Google Sets a Deadline for AI Agents Working in Gmail

AI 摘要Google announced that AI agents working with Gmail, Docs, and other Workspace apps must switch from traditional APIs to Workspace MCP servers or the Workspace CLI, with enforcement starting February 1, 2027, and paid 'Scaled tier' billing beginning April 1, 2027. Meanwhile, Anthropic introduced 'Skills over MCP,' letting apps connected to Claude provide step-by-step instructions for complex tasks like managing a Shopify store, now in public beta. Both companies are betting on MCP (Model Context Protocol) as the shared standard for connecting AI assistants to external applications.

Quiz: Python Timer Functions: Three Ways to Monitor Your Code

AI 摘要This article introduces a quiz that tests your understanding of Python timer functions and code monitoring techniques. It covers why time.perf_counter() is the preferred clock for timing code, as well as how to implement a timer using a class, a context manager, and a decorator. The quiz also reviews timeit and cProfile for benchmarking and profiling Python programs.

The Real Python Podcast – Episode #320: Optimizing Python Performance & Building a Django Static Site

AI 摘要This episode of The Real Python Podcast features Christopher Trudeau discussing a batch of articles and projects from PyCoder's Weekly. The main topics include moving from profiling a Python program's performance to optimizing it, along with common techniques for speeding up code and which approaches to avoid. The episode also covers building a Django static site.

Quiz: Python and TOML: Read, Write, and Configure with tomllib

AI 摘要This article introduces a quiz that tests your understanding of reading, writing, and configuring TOML files in Python. It revisits TOML syntax—including key-value pairs, tables, arrays, and dates—and covers loading TOML with tomllib, writing it with tomli_w, and editing existing documents with tomlkit without losing comments or formatting.

pandas Project: Make a Gradebook With Python & pandas

AI 摘要This article introduces a tutorial project in which teachers learn to use Python and pandas instead of spreadsheets to build a gradebook script that loads student data from multiple CSV sources, merges it, and calculates final letter grades. The project involves four main steps: exploring the data, loading it into pandas DataFrames, calculating grades and saving them as CSV files, and plotting grade distributions. Aimed at readers with basic pandas experience, the tutorial produces output compatible with school grading systems and includes links to background reading resources.

The No AI Slop Manifesto: A Pledge to Own What Agents Ship

AI 摘要The No AI Slop Manifesto, announced by Dex Horthy at the AIE Code Summit 2026 in San Francisco, defines AI slop as work produced with less effort than it demands from its reader, occurring when people pass AI-generated output along without taking responsibility for its quality. Modeled after the 2001 Agile Manifesto, it contains five values, nine beliefs, and twelve resolutions committing signers to own what their AI agents ship. Critics question the effort-based definition of slop and doubt the manifesto can overcome business incentives that favor cheap AI-generated code.

LLM Evaluation in Python: Build an Eval Harness From Scratch

AI 摘要This Real Python tutorial teaches readers how to build an LLM evaluation harness from scratch in Python, using a customer-support bot as the working example. The framework-agnostic harness combines deterministic code checks with an LLM judge (calibrated against human-labeled examples) to score outputs across criteria like correctness, safety, helpfulness, and tone. It compares two prompt versions on the same test cases and returns a PASS, FAIL, or REVIEW release decision with an exit code suitable for CI, blocking any change that introduces new blocker failures.

Quiz: The No AI Slop Manifesto: A Pledge to Own What Agents Ship

AI 摘要This article introduces a quiz based on The No AI Slop Manifesto: A Pledge to Own What Agents Ship, designed to test readers' understanding of the manifesto's key ideas. The quiz covers how the manifesto defines slop, why producing work has become cheaper than reviewing it, and what owning AI-generated code means in practice. It also revisits which problems linters and type checkers catch, why slop compounds in a codebase, and what critics dispute.

Quiz: LLM Evaluation in Python: Build an Eval Harness From Scratch

AI 摘要This article introduces a quiz that tests your understanding of building an LLM evaluation harness from scratch in Python. It revisits key concepts such as translating product expectations into explicit criteria, deciding when to use code checks instead of an LLM judge, and verifying and calibrating a judge against human labels. The quiz also covers how a release gate can be used to compare two prompt versions.