News for hackers. Stuff that matters.
Re:Stop passing naked dictionaries around: Introducing DStru... by dorkitude on Thursday November 24, 2011 @01:11PM (#3274995)
Namedtuple is a very useful module, but it doesn't enforce typing. Furthermore, it doesn't expose extensible classes, unless you want to write the sort of code you see when you pass `verbose=True` into the namedtuple constructor (http://drktd.com/C4QF). So while a game's BaseBuilding may require the "x", "y", and "building_type_id" fields, your FarmVille Plant may add "planted_time" in it's schema, plus a "harvestable_after_time" computed property.

In the abstract, tuples simply arent suites to all problems (any more than are dicts): order doesn't always matter, and immutability certainly is not always desired.

(As for those dependencies, they're submoduled in the repo: try `git clone --recursive`)

There are no comments on this comment yet.