avatar
Shriram Krishnamurthi @shriram.bsky.social

Super excited to release the latest version of "A Data-Centric Introduction to Computing" (DCIC). See release notes for 2025-08-27 for what's changed and new (a LOT!): dcic-world.org/2025-08-27/R.... dcic-world.org

aug 28, 2025, 1:21 am • 50 11

Replies

avatar
Srikumar @sriku.org

In the "from pyret to python" track, "data classes" are introduced as the counterpart for pyret's "data". Were NamedTuples (`from typing`) not considered for that stage (since they're also immutable) to avoid proliferating concepts? NTs might be a better fit there and dataclasses for mutables right?

aug 28, 2025, 2:43 am • 1 0 • view
avatar
Shriram Krishnamurthi @shriram.bsky.social

Great question. I'm going to refer this to the people most responsible for that. Personally, I've always *thought* of data classes as the right analog, since they are a lightweight form of defining structures. But Python keeps adding features and this is one I missed!

aug 28, 2025, 11:37 am • 1 0 • view
avatar
Kathi Fisler @kfisler.bsky.social

When I wrote the first version of the materials that became the early part of DCIC, multiple people who used Python in practice more than I did recommended data classes. I seem to recall trying NamedTuples a couple of years later. >>

aug 28, 2025, 12:10 pm • 1 0 • view
avatar
Kathi Fisler @kfisler.bsky.social

I vaguely recall having problems with `typing` at the time (2019ish), and I didn't want to force it on the students. I also like dataclasses because they provide a lightweight use of the class concept. I was setting that up for my students because they were going from DCIC into a course on OO. >>

aug 28, 2025, 12:13 pm • 2 0 • view
avatar
Kathi Fisler @kfisler.bsky.social

I'd have to think a bit more about other differences (when the start of the semester isn't upon me). I do see why NamedTuples could feel more in line with the DCIC style, but I also see the challenges that students have jumping into full classes after the syntactic brevity of Pyret and Python.

aug 28, 2025, 12:16 pm • 2 0 • view
avatar
Srikumar @sriku.org

That's understandable. The early incarnations of NT have been kinda yuck to force on students. However the recent versions have solidified NamedTuple to not even require explaining decorators. It read a tad awkward in the text having to explain why the dataclass didn't change form to get mutability.

aug 28, 2025, 2:59 pm • 1 0 • view
avatar
Srikumar @sriku.org

typing.python.org/en/latest/sp... - to add to the confusion, googling for "python namedtuple" still takes students to the older form in the "collections" module. So I was wondering what went into the choice.

aug 28, 2025, 3:03 pm • 1 0 • view