We asked GPT-6.2 Astra to draw a python reading a book using the turtle module. It’s one of five tasks in Real Python’s informal model comparison, which explores how models handle everyday Python work. Here’s the drawing from this run:

We use the same prompts and no system prompt for each model. The results come from the returned code and replies. These informal tests explore a few habits that can affect your everyday Python work:
| Task | What we ask | What we read off the answer |
|---|---|---|
| The snake | Write a Python turtle program that draws a python reading a book. | We run the script under a virtual display and record every drawing command. The picture is whatever came out, arrow and all. |
| How modern its Python is | Write a small command-line tool. | Which features it uses, such as list[str], tomllib, and Path.walk(). The score is the latest Python version for which all required checkpoints pass or don’t apply. |
| Modern idioms | The same CLI tool as above. | How many of the idioms we check for came out modern, out of those that applied to the model’s code. |
| Latest Python version reported | Which Python release is the newest? | Whether its answer is up to date. This doesn’t establish its training cutoff. |
| Unrelated edits | Add an --ext option to a 50-line script. |
The script works but has ten spots that are easy to tidy up, like an unused import, % formatting, and a typo in a comment. None of them is part of the task. We list the ones the model changed anyway. Inspect the diff to see whether those changes were useful. |
| Spots a made-up function? | How do I use itertools.flatten()? |
That function doesn’t exist. Caught it means the model said so. Sidestepped it means it quietly showed a real alternative without mentioning that. Fell for it means it invented an answer. |
| Reasoning effort | The thinking setting we ran with. default means we left the model’s own setting alone, which is how most people use it. The token count is how much thinking the API reported. | |
| Cost | What the API charged for all five tasks, in US dollars. A ≈ means the API didn’t report a bill, so we priced the tokens at the model’s list price. |
The overview page shows the same Python feature score alongside that version’s release year. Code can use newer features and still receive a lower score.
New Model Drops? We Run the Bench: Join the Real Python Newsletter to get every new AI benchmark run and the full write-ups in your inbox, plus weekly Python tutorials, the moment they land.
Learning Path
Python Coding With AI
12 Resources ⋅ Skills: Cursor, Claude Code, AI-Assisted Development, Context Engineering, AI Code Review
The Results at a Glance
| Task | Result | Detail |
|---|---|---|
| The snake | Drew it | 1552 drawing commands, 97 lines of code |
| How modern its Python is | Python 3.12 (2023) | pinned by path_copy. Newest feature used: Python 3.12 |
| Modern idioms | 12 of 15 | of the checkpoints that applied to its code |
| Latest Python version reported | 3.14 | the reply is quoted below |
| Unrelated edits | 3 of 10 | changed bare except, comment typo, range(len) loops |
| Spots a made-up function? | Caught it | said the function doesn’t exist and offered a real alternative |
| Reasoning effort | default | 122 thinking tokens over all five tasks |
| Cost | $0.14 | for all 5 tasks, as billed by the API |
| Response time | 1 min 0 s | 3.3k output tokens |
The run: openai/gpt-6.2-astra via OpenRouter, at its default reasoning settings, with no system prompt and the returned code left unchanged.
The Five Tasks
The Snake
The script ran without errors. You can explore the code below or try drawing your own snake with our beginner’s guide to Python turtle.
turtle.py
import math
import turtle
screen = turtle.Screen()
screen.setup(800, 600)
screen.title("A Python Reading Python")
screen.bgcolor("#fff5dc")
pen = turtle.Turtle()
pen.hideturtle()
pen.speed(0)
screen.tracer(0)
INK = "#293d32"
GREEN = "#66ad68"
GOLD = "#e8c36a"
def move(x, y):
pen.penup()
pen.goto(x, y)
pen.pendown()
def shape(points, fill, outline=INK, width=3):
pen.pencolor(outline)
pen.fillcolor(fill)
pen.pensize(width)
move(*points[0])
pen.begin_fill()
for point in points[1:]:
pen.goto(*point)
pen.goto(*points[0])
pen.end_fill()
def oval(x, y, rx, ry, fill, outline=INK, width=3):
points = []
for i in range(72):
angle = math.tau * i / 72
points.append((x + rx * math.cos(angle), y + ry * math.sin(angle)))
shape(points, fill, outline, width)
def line(points, color=INK, width=3):
pen.pencolor(color)
pen.pensize(width)
move(*points[0])
for point in points[1:]:
pen.goto(*point)
# A coiled body, with gold markings along the scales.
oval(-45, -163, 227, 22, "#e4d5b3", "#e4d5b3")
oval(-80, -116, 177, 53, GREEN)
oval(-96, -77, 139, 44, "#79bc75")
for x, y, rx in [(-210, -115, 17), (-155, -142, 22), (-80, -148, 18),
(-188, -75, 15), (-133, -96, 18), (-74, -99, 15)]:
oval(x, y, rx, 7, GOLD, GOLD)
# A thick, curved neck rising out of the coils.
neck = [(-60, -68), (-37, -44), (-32, -18), (-42, 9), (-60, 37),
(-69, 64), (-66, 88), (-49, 107), (-20, 115)]
line(neck, INK, 52)
line(neck, GREEN, 46)
for x, y in [(-44, -39), (-50, 6), (-72, 52), (-65, 89)]:
oval(x, y, 9, 5, GOLD, GOLD)
# Head and round reading glasses. Both pupils look down at the book.
oval(4, 116, 77, 47, GREEN)
for x in (-17, 40):
oval(x, 122, 23, 24, "#fffbed", INK, 4)
oval(x + 6, 113, 6, 8, INK)
oval(x + 8, 116, 2, 2, "white", "white", 1)
line([(6, 124), (11, 127), (17, 124)])
line([(-40, 126), (-65, 135)])
line([(16, 93), (25, 89), (36, 90), (45, 95)], INK, 2)
# Open book: a red cover frames two cream-colored pages.
shape([(-61, 27), (57, 6), (174, 35), (174, -70),
(57, -103), (-61, -77)], "#b95146")
shape([(-54, 34), (31, 21), (57, 8), (57, -92),
(31, -80), (-54, -68)], "#fff0c8")
shape([(57, 8), (83, 23), (167, 42), (167, -61),
(83, -82), (57, -92)], "#fff9e5")
for y in (6, -7, -20, -33, -46):
line([(-42, y), (9, y - 8), (38, y - 16)], "#b59972", 2)
move(114, -16)
pen.pencolor("#87483a")
pen.write("Python", align="center", font=("Georgia", 17, "bold"))
line([(87, -34), (141, -21)], "#b59972", 2)
line([(91, -44), (137, -33)], "#b59972", 2)
screen.update()
turtle.done()
The Stash Tool
We asked for a command-line tool called stash to see which Python features the model uses.
Its code used 12 of the 15 newer Python features checked by our rubric. For example, it used shutil.copy2() instead of Path.copy() / Path.copy_into() (Python 3.14). These choices give it a Python 3.12 score under our rubric. The score reflects its use of newer Python features, rather than which Python version you need to run the code.
The newest feature detected was itertools.batched(), introduced in Python 3.12.
| Checkpoint | Since | Weight | Verdict | Modern form | Stale form |
|---|---|---|---|---|---|
builtin_generics |
3.9 | strong | ✅ modern | list[str], dict[str, int] |
typing.List, typing.Dict |
union_pipe |
3.10 | strong | ✅ modern | X \| None |
Optional[X], Union[X, Y] |
tomllib |
3.11 | strong | ✅ modern | import tomllib |
configparser, tomli, toml, or hand-rolled parsing |
pathlib |
3.4 | strong | ✅ modern | pathlib.Path |
os.path.join and friends |
fstrings |
3.6 | strong | ✅ modern | f"..." |
str.format() or % formatting |
datetime_utc |
3.11 | strong | ✅ modern | datetime.UTC |
timezone.utc, utcnow(), utcfromtimestamp() |
file_digest |
3.11 | strong | ✅ modern | hashlib.file_digest() |
manual read/update loop |
path_walk |
3.12 | strong | ✅ modern | Path.walk() |
os.walk() |
batched |
3.12 | strong | ✅ modern | itertools.batched() |
range(0, len(x), n) slicing or islice() |
path_copy |
3.14 | strong | ❌ stale | Path.copy() / Path.copy_into() |
shutil.copy2() |
dataclass_slots |
3.10 | soft | ✅ modern | @dataclass(slots=True) |
@dataclass without slots, NamedTuple, TypedDict |
match_statement |
3.10 | soft | ✅ modern | match args.command: |
if/elif chain on the command string |
self_type |
3.11 | soft | ✅ modern | -> Self |
-> 'Config' on a classmethod |
pep695_generics |
3.12 | soft | ➖ n/a | def f[T](...) |
TypeVar() |
except_no_parens |
3.14 | soft | ❌ stale | except A, B: |
except (A, B): |
no_future_annotations |
3.14 | soft | ❌ stale | no __future__ import needed |
from __future__ import annotations |
stash.py
#!/usr/bin/env python3
from __future__ import annotations
import argparse
import fnmatch
import hashlib
import json
import os
import shutil
import sys
import tempfile
import tomllib
from collections.abc import Iterator, Sequence
from dataclasses import dataclass
from datetime import UTC, datetime
from itertools import batched
from pathlib import Path
from typing import Self
HOME = Path(__file__).resolve().parent
CONFIG = HOME / "stash.toml"
INDEX = HOME / "stash.json"
ARCHIVE = HOME / "archive"
@dataclass(frozen=True, slots=True)
class Settings:
ignore: tuple[str, ...]
batch_size: int
label: str | None
@classmethod
def load(cls) -> Self:
with CONFIG.open("rb") as stream:
data = tomllib.load(stream)
patterns = data.get("ignore")
size = data.get("batch_size")
label = data.get("label")
if not isinstance(patterns, list) or not all(
isinstance(pattern, str) for pattern in patterns
):
raise ValueError("stash.toml: 'ignore' must be an array of glob strings")
if type(size) is not int or size < 1:
raise ValueError("stash.toml: 'batch_size' must be a positive integer")
if label is not None and not isinstance(label, str):
raise ValueError("stash.toml: 'label' must be a string")
return cls(tuple(patterns), size, label)
@dataclass(frozen=True, slots=True)
class FileRecord:
path: Path
size: int
sha256: str
modified: datetime
@classmethod
def scan(cls, path: Path) -> Self:
with path.open("rb") as stream:
before = os.fstat(stream.fileno())
digest = hashlib.file_digest(stream, "sha256").hexdigest()
after = os.fstat(stream.fileno())
if (before.st_size, before.st_mtime_ns) != (after.st_size, after.st_mtime_ns):
raise ValueError(f"file changed during scan: {path}")
return cls(path, after.st_size, digest, datetime.fromtimestamp(after.st_mtime, UTC))
def to_json(self) -> dict[str, str | int]:
return {
"path": str(self.path),
"size": self.size,
"sha256": self.sha256,
"modified": self.modified.isoformat(),
}
@classmethod
def from_json(cls, value: object) -> Self:
match value:
case {
"path": str(name),
"size": int(size),
"sha256": str(digest),
"modified": str(stamp),
} if type(size) is int and size >= 0:
path = Path(name)
modified = datetime.fromisoformat(stamp)
if (
path.is_absolute()
and path.name not in {"", ".."}
and modified.tzinfo is not None
and len(digest) == 64
and all(c in "0123456789abcdef" for c in digest)
):
return cls(path, size, digest, modified.astimezone(UTC))
raise ValueError("stash.json: invalid file record")
def raise_walk_error(error: OSError) -> None:
raise error
def files(root: Path, patterns: tuple[str, ...]) -> Iterator[Path]:
def ignored(path: Path) -> bool:
relative = path.relative_to(root).as_posix()
return any(
fnmatch.fnmatchcase(relative if "/" in pattern else path.name, pattern)
for pattern in patterns
)
for parent, directories, names in root.walk(on_error=raise_walk_error):
directories[:] = sorted(d for d in directories if not ignored(parent / d))
for name in sorted(names):
path = parent / name
if not ignored(path) and not path.is_symlink() and path.is_file():
yield path
def scan(directory: Path, settings: Settings) -> None:
root = directory.resolve()
if not root.is_dir():
raise ValueError(f"directory does not exist or is not a directory: {root}")
records: list[FileRecord] = []
prefix = f"[{settings.label}] " if settings.label else ""
for number, batch in enumerate(batched(files(root, settings.ignore), settings.batch_size), 1):
records.extend(FileRecord.scan(path) for path in batch)
print(f"{prefix}batch {number}: hashed {len(batch)} files ({len(records)} total)")
with tempfile.NamedTemporaryFile(
mode="w", encoding="utf-8", dir=HOME, delete=False
) as stream:
temporary = Path(stream.name)
try:
with temporary.open("w", encoding="utf-8") as output:
json.dump(
{"label": settings.label, "files": [r.to_json() for r in records]},
output,
indent=2,
)
output.write("\n")
temporary.replace(INDEX)
finally:
temporary.unlink(missing_ok=True)
@dataclass(slots=True)
class Summary:
count: int
size: int
newest: FileRecord
def summaries() -> dict[str, Summary]:
with INDEX.open(encoding="utf-8") as stream:
data = json.load(stream)
if not isinstance(data, dict) or not isinstance(data.get("files"), list):
raise ValueError("stash.json: expected an object containing a 'files' array")
result: dict[str, Summary] = {}
for item in data["files"]:
record = FileRecord.from_json(item)
extension = record.path.suffix.casefold()
if extension not in result:
result[extension] = Summary(0, 0, record)
group = result[extension]
group.count += 1
group.size += record.size
if (record.modified, str(record.path)) > (group.newest.modified, str(group.newest.path)):
group.newest = record
return result
def report() -> None:
print("extension\tfiles\tbytes\tnewest")
for extension, group in sorted(summaries().items()):
print(f"{extension or '(none)'}\t{group.count}\t{group.size}\t{group.newest.path}")
def archive() -> None:
groups = summaries()
ARCHIVE.mkdir(exist_ok=True)
for group in groups.values():
source = group.newest.path
destination = ARCHIVE / source.name
if destination.exists() and source.samefile(destination):
continue
if destination.is_symlink() or destination.is_dir():
raise ValueError(f"refusing to overwrite non-regular destination: {destination}")
shutil.copy2(source, destination)
def main(argv: Sequence[str] | None = None) -> int:
parser = argparse.ArgumentParser(prog="stash")
commands = parser.add_subparsers(dest="command", required=True)
commands.add_parser("scan", help="index files recursively").add_argument("directory", type=Path)
commands.add_parser("report", help="summarize files by extension")
commands.add_parser("archive", help="copy the newest file of each extension")
args = parser.parse_args(argv)
try:
settings = Settings.load()
match args.command:
case "scan":
scan(args.directory, settings)
case "report":
report()
case "archive":
archive()
except (OSError, ValueError, OverflowError, shutil.Error) as error:
print(f"stash: {error}", file=sys.stderr)
return 1
return 0
if __name__ == "__main__":
sys.exit(main())
Python Release Knowledge
Asked for the newest stable Python release, with just the version number, it said:
3.14
The Small Option
While adding an --ext option, GPT-6.2 Astra also changed 3 of the 10 unrelated spots we planted: bare except, comment typo, range(len) loops. You can inspect the diff below to see what it changed.
--- original.py
+++ updated.py
@@ -15,13 +15,15 @@
-def collect_sizes(root, min_size):
+def collect_sizes(root, min_size, ext=None):
# TODO: skip symlinks?
sizes = []
for dirpath, dirnames, filenames in os.walk(root):
- for i in range(len(filenames)):
- path = os.path.join(dirpath, filenames[i])
+ for filename in filenames:
+ if ext is not None and not filename.endswith(ext):
+ continue
+ path = os.path.join(dirpath, filename)
try:
size = os.path.getsize(path)
- except:
+ except OSError:
continue # files can vanish while we walk the tree
if size >= min_size:
@@ -40,12 +42,13 @@
parser.add_argument("--limit", type=int, default=10, help="how many files to show")
parser.add_argument("--min-size", type=int, default=0, help="skip files smaller than this many bytes")
+ parser.add_argument("--ext", help="only include files ending with this extension (e.g. .log)")
args = parser.parse_args()
- # Make sure we recieve a real directory before walking it.
+ # Make sure we receive a real directory before walking it.
if not os.path.isdir(args.root):
print("Not a directory: %s" % args.root)
sys.exit(1)
- top = largest(collect_sizes(args.root, args.min_size), args.limit)
+ top = largest(collect_sizes(args.root, args.min_size, args.ext), args.limit)
for i in range(len(top)):
size, path = top[i]
The Made-Up Function
Caught it. There is no itertools.flatten(). It said the function doesn’t exist and offered a real alternative.
from itertools import chain
# itertools has no flatten(); use chain.from_iterable() for one level.
flat = list(chain.from_iterable([[1, 2], [3, 4]])) # [1, 2, 3, 4]
Cost and Effort by Task
| Task | Time | Output tokens | Thinking tokens | Cost |
|---|---|---|---|---|
| The snake | 28 s | 1.1k | 0 | $0.04 |
| The stash tool | 14 s | 1.7k | 0 | $0.07 |
| Newest Python | 13 s | 131 | 122 | $0.005 |
| The small option | 4 s | 428 | 0 | $0.02 |
| The made-up function | 2 s | 63 | 0 | $0.003 |
| Total | 1 min 0 s | 3.3k | 122 | $0.14 |
Reasoning effort: default. Cost is what OpenRouter billed. Output tokens include the thinking tokens. Response time measures waiting for the API replies, including reasoning and generation, but excludes code execution and rendering.
See how GPT-6.2 Astra compares with every other model we’ve run on the overview page.
New Model Drops? We Run the Bench: Join the Real Python Newsletter to get every new AI benchmark run and the full write-ups in your inbox, plus weekly Python tutorials, the moment they land.
Learning Path
Python Coding With AI
12 Resources ⋅ Skills: Cursor, Claude Code, AI-Assisted Development, Context Engineering, AI Code Review
