Thinking Through LLM Policy in Python for DH
Back in May, I was hired as a lecturer at UC Berkeley’s Summer Digital Humanities Institute. From then to July, I taught a section of DIGHUM101: Python Programming for Digital Humanities. It was a whirlwind class––just six weeks to cover programming basics and DH methods in Python. The class has been part of the Berkeley Summer DH program for many years now, so thankfully, I didn’t have to come up with anything from scratch. They provided a heap of materials and lessons as well as the freedom to adapt, revise, and hone.
I didn’t change anything in terms of the fundamental components of the class. The learning objectives, DH methods, and general schedule were quite sound. And regardless, I would have had no business changing the fundamentals as a fresh hire with only a couple weeks before the start of class. But there was one glaring fundamental, lately relevant, that I had to grapple with: coding with LLMs.
Most of the past sections were from “the before times.” Last summer, Merve Tekgurler adapted a few lessons with notes on LLMs that addressed their environmental and social consequences, and their capacity as coding assistants. This was quite helpful. I reapplied their approach in my section, being sure to carve out time at various points in the semester to situate LLMs ethically and technically. But even between summers 2025 and 2026, the capacity of LLMs for coding had advanced substantially. Going into my summer section, I definitely felt like I was heading into some unknown territory. How could I, and should I, leverage LLMs in an introductory Python DH class? Would students already be familiar with LLMs as coding agents or assistants? In what ways could I help them differentiate between coding assistants, agentic coding, vibe coding, and plagiarism? But most importantly, I wondered, would LLMs help or hinder students in learning Python for DH purposes?
If you’ve ever spoken with me about pedagogy, you’ll know I was trained as a writing instructor. This means I often think about teaching through the pedagogical lenses of rhetoric & composition, especially process theories of composition. I like process theory because it considers the numerous, disparate tasks that culminate in knowledge production and seeks to support students as they master those tasks within the larger learning process. While it originates from composition studies, I’ve found process theory to be useful in learning and teaching everything from programming languages to literary studies. As an instructor, process theory encourages me to dissect larger systems of knowledge production. It makes me more prepared to meet students where they are in the process. And when students are explicitly made aware of the process paradigm, it also encourages them to think metacognitively about their learning and their experiences with small tasks and practices embedded into their coursework.
So, as I prepared my Python class at UC Berkeley, I ruminated on this moment in pedagogy, AI technology, and coding, and found myself thinking about an old composition studies paper I read years ago, titled “A Cognitive Process Theory of Writing.” It’s by Linda Flower and John R. Hayes. It’s a great article, one that’s had a lot of influence on me. In a nutshell, it claims that writing is best understood as a set of distinct cognitive processes that writers continually move between while composing. The authors make a number of claims, but the thing that sticks out to me is that they essentially argue that writing (and thinking more generally) is a recursive process. When faced with a text to write or a concept to grasp, we plan, generate, organize, create, evaluate, revise. Yet none of it is linear. There are no clear stages. We trod on and back and forth, evolving our larger process to fit new goals or reinforce certain concepts, until we “get it.”
In a traditional coding classroom, this messy process of learning––what Flower & Hayes call the “cognitive process model”––may not be explicit to students. I believe students are always doing it, the recursive thinking to wrap their heads around new ideas, skills, technologies, etc., but in coding classrooms, the curriculum isn’t likely designed to emphasize this messiness, or to make students aware of it. When I think back to my own education with Python, for example, my learning process tended to be frenetic. I’d be introduced to a coding concept, idea, method, or library in class. Then through sequences that varied depending on the complexity of the learning goal, I would bounce between blind attempts to code, reading textbook materials, watching online tutorials or class recordings, and so forth, until I could reasonably understand and complete the coding homework (usually formulated as a quiz or exam). What was this messiness? In hindsight, I think it was this same recursive cognitive process that Flower & Hayes describe for writing. But for coding, the process was concerned with concepts––everything from data types and structures and Python syntax to libraries and functions. Yet my coding classes never laid out this messiness as an inevitable part of learning how to code. Once we finished covering something, we moved on, relying on homework results, test results, and final coding projects to demonstrate mastery––not to reflect on what we learned or how we learned it.
Another thing that strikes me is that, in coding classrooms, these cognitive processes have always relied on pedagogical resources: the tutorials, lectures, textbooks, coding examples, and documentation. With some basic instruction, it doesn’t take long to get a foundation in Python––the vocabulary for data types, data structures, syntax, control structures, etc.––but applying any of that knowledge tends to require many deep dives into these pedagogical resources. And no part of that experience is made explicit. It’s an information retrieval task, but beginner programmers won’t necessarily know how to navigate those resources. They might know they’re dealing with a data type or structure or perhaps a library, and they might know they need to write a function to complete some processing step for their data, but how, exactly, do they unify these elements into executable code? The learning process rarely proceeds by “just writing the code”––although, there’s a threshold where that becomes possible––but rather, beginner programmers sift through resources, and that can be time-consuming, difficult, and discouraging.
This is where I think LLMs can genuinely improve the experience of learning to code. Used as coding assistants, they can take on some of the information retrieval labor that has always been part of learning Python. Instead of searching through Stack Overflow (RIP), documentation, textbooks, or tutorials to figure out how to sort a DataFrame by two columns, a student can ask an LLM about the problem they are actually working through and study the Python it shows them. And more importantly, they can follow up: why does this return a DataFrame rather than a Series? What does `axis=1` mean here? Can you show me another example? Would this work with a list instead? For a seasoned programmer, these are simple questions, but answering them is part of how a newbie builds relationships between concepts. That’s where LLMs show a lot of promise. They can focus the cognitive process of learning by stripping away the interruptions from having to retrieve information.
Some might categorize this as “cognitive offloading,” and I think that critique is worth taking seriously. But I’m not convinced that it describes what is happening in this particular kind of LLM use. Looking up documentation is not itself the cognitive process I care most about students mastering. In an introductory Python for DH course, the important work is identifying the problem, understanding the concepts involved, evaluating possible solutions, and integrating those concepts into a crystallizing mental model of Python. If an LLM reduces the labor required to find relevant information while leaving that intellectual work with the student, then what has been offloaded is largely information retrieval, not cognition. In fact, because students can immediately ask questions about the information they retrieve, the interaction can make some of that cognition more explicit. That, of course, requires the students to be conscientious about their LLM usage. But I trusted mine with that responsibility. To build that trust, I openly discussed the expectations of responsible LLM usage (or refusal, if students preferred), and we took time in class and during my office hours to work through coding exercises with LLMs, thereby demonstrating how students could ask questions, clarify structures, recall parameters or functions, etc. In this process, I observed that complete beginners were able to go a long way in their understanding of Python in just a few weeks. They were more competent in that time than I would have been when I was at their stage of learning, in the before times. And they were more aware of their learning process. These interactions had the benefit of turning what would otherwise feel like quiz questions or problems into conversations about code––a medium for learning that I think most students prefer.
Of course, there is another enormous caveat to all of this: LLMs don’t just retrieve or explain information. They generate code. A student can paste an assignment to an LLM and ask for an answer. They can paste in broken code and ask for a corrected version without ever understanding what was wrong. In 2026, they can even hand an entire project over to a coding agent that reads files, writes code, executes it, encounters errors, revises its approach, and keeps working until the program runs. At any of these points, the distinction between assistance and substitution becomes impossible to ignore: it’s cognitive offloading. And plagiarism, if not properly disclosed. But I don’t think the distinction was lost on my students. We spoke openly about what could be done, and what should be done, with LLMs, versus what was improper use. In these transparent conversations, the distinction was not made by threatening students or imposing burdens of proof upon them. In my class, such approaches weren’t necessary because so much of the course was framed around processes. My student knew I didn’t care all that much about how breathtaking or brilliant their coding demonstrations might be. I cared about how well they recognized their own learning processes, and how well they could explain their code to me or anyone else.
Now let me circle back to one thing. Earlier I mentioned a threshold where writing code begins to feel less like piecing together information and more like simply writing code. I think a lot of programmers remember that feeling, the rush of the first time ever getting up-and-running and making things work on their own. For me, it was in my first semester as a PhD student. I successfully built a function that printed the text of “99 Bottles of Beer on the Wall” and that closed itself after the 99th bottle. Good times!
But did my students reach this threshold? Did they ever get to the point where they could build executable code without referring to an LLM or other resources? To be honest, I couldn’t tell you for certain; although, in at least one case, yes, a student told me so. But generally speaking, if students entered the class with no programming experience, they probably didn’t reach this threshold. But I don’t think that was ever a reasonable goal for a six-week introductory class. I also don’t think that threshold is necessary for everyone in DH. By the end of the semester, however, all of my students showed progress in two ways: 1) at minimum, the ability to read and comprehend Python; and 2) an awareness of their own progress in learning Python and DH methods facilitated by the explicit application of the process paradigm. This second point is what mattered most to me. After six weeks, I wanted students to have a foundation in Python, and an awareness of what they could continue to learn, practice, and do with it in DH.
Let me conclude now by listing a few other things. They are principles or takeaways about LLMs in coding classes from my summer class at UC Berkeley. Feel free to borrow them or adapt them or disagree with them as you see fit, but where I currently stand, I think any coursework involving Python and LLMs should do the following:
- At the beginning of a coding class, explain the technical functionalities of LLMs. Make sure students know how they’re trained, how they convert text to embeddings, how they’re stochastic, how they’re built with Transformer architectures. Remove any technical misconceptions so students are more well-informed.
- Address the developing implications of LLMs for the environment and the job market. Discuss the ethical concerns of using technologies owned and controlled by exploitative corporations. Let students opt out, if they choose. Provide other resources, as coding classes always have.
- Through transparent pedagogy (in my case, process theory), emphasize student learning over the deliverables. Encourage students to think metacognitively about their own learning and how LLMs help or hinder them.
- Clarify the difference between LLMs as coding assistants for information retrieval versus agentic coding, vibe coding, or straight up plagiarism. Permit the former. Make it clear the latter hinders student learning. Trust your students to make the right decisions for their learning goals and processes.
