Skip to content

Conversation

@zyros-dev
Copy link

Claude teach-in

This is an idea I had recently to make Claude 'onboard' me to a repo. I used CPython because I wanted to learn a bit about python internals. I'll expand more on this later...

- CLAUDE.md: Teaching mode instructions and architecture overview
- teaching-todo.md: 5-phase curriculum building toward Record type
- teaching-notes.md: Detailed implementation notes (for Claude reference)

The learning project implements a Record type (immutable named container)
and BUILD_RECORD opcode, covering PyObject fundamentals, type slots,
the evaluation loop, and build system integration.
Document practical issues encountered during Record type implementation:
- Hash constants not publicly exposed (copy from tupleobject.c)
- GC trashcan macros for deep recursion protection
- PyUnicode_Compare error handling
- Opcode number selection (166 after DICT_UPDATE)
- Python-level constructor (tp_new) for testing
- Type initialization order in object.c and bltinmodule.c
- Correct allocator (PyObject_GC_NewVar)
- tp_basicsize calculation for flexible array members

Also added testing checklist for verifying implementation.
@bedevere-app
Copy link

bedevere-app bot commented Dec 25, 2025

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@python-cla-bot
Copy link

The following commit authors need to sign the Contributor License Agreement:

CLA not signed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant