Work effectively with AI coding agents. Understand them as language models running in a tool loop with limited context, which is why they guess, game the visible signal and report confidently. Recognise the shortcut and correctness tells in their code across Python, TypeScript/JavaScript, Rust, Java and Go, and know the damage each one does later. Verify changes instead of trusting them, review diffs fast for quality and security, judge when work is truly finished, and choose, design and steer tasks so agents can finish them well.
Invented APIs, flags, config keys and packages
card 5 of 6
A removed method on a rare path
builds on: Training cutoff and API drift
After a pandas upgrade, the agent edits an export job. In the branch for late orders it writes `df = df.append(row, ignore_index=True)`. The tests pass because none of them hit that branch.
`DataFrame.append` was removed in pandas 2.0, so the job raises `AttributeError` on the first late order.
A ten-second check: `$ python -c "import pandas as pd; print(pd.__version__, hasattr(pd.DataFrame, 'append'))"` prints `2.2.2 False`.
BETTER: `pd.concat([df, pd.DataFrame([row])], ignore_index=True)`.
Terms on this card
- pandas
- A widely used Python library for working with tables of data.
- DataFrame
- The pandas table type: rows and named columns.
- AttributeError
- Python's runtime error when code accesses a method or attribute an object doesn't have. It is raised only when that line executes.
- the agent
- The AI coding system doing the work: a chat assistant, IDE agent or terminal agent.
- python -c
- Runs a Python program given directly as text on the command line, so any action can hide inside one command.
Lesson goal: Recognise idiomatic-looking calls to methods, CLI flags, config options or packages that do not exist or belong to a different version: removed APIs, old import paths, options the installed version lacks. Check cheaply that each one exists, using the compiler, the docs, `--help` or the registry. ·
the whole lesson