Skip to content

Add defaultdict missing-key pitfall - #6

Merged
EMRahman merged 2 commits into
mainfrom
codex/defaultdict-missing-key
Nov 16, 2026
Merged

EMRahman merged 2 commits into
mainfrom
codex/defaultdict-missing-key

Conversation

@EMRahman

Copy link
Copy Markdown
Owner

Adds basic pitfall #74: defaultdict inserts a missing key when it is read with bracket access.

  • runnable example contrasting intended counting with the typo/unknown-service trap
  • shows the non-mutating .get() path
  • adds the Fundamentals table entry and explanation

The key point: defaultdict is right for deliberate aggregation, but is a poor fit when an unknown key must fail loudly.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-16T09:01:00.724319Z 6a9e238 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@EMRahman
EMRahman merged commit 25e641a into main Nov 16, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant