Porting the Loan Kit Model
You ported the Northbank Tool Library’s loan kit model to JavaScript. In Python, each kit has a code, a trimmed label and its own list of tools. A property validates the label,
__iter__ lets you loop over the tools as often as you like, and two cooperative mixins wrap the
description: one tags it, and one audits it.
The Python script prints five lines: each kit’s description and tools, the drilling kit’s tools
twice. The port must match them. One line won’t map directly: LoanKit has three bases, and
extends takes one. The label printer and tool count wait for the exercise.
Python’s class attribute becomes a static field, so Kit.kind reads tool kit. A Python kit reads
tool kit too, but a JavaScript kit reads undefined: its lookup climbs prototypes, never the class,
so it can’t reach a static field. The port never needs it there.
The constructor stores the code and the label, and spread copies the tools, as list() does, so
each kit owns its list. The property becomes a getter and a setter that trims the text into
_label. Assigning this.label in the
constructor, not declaring a field, runs the setter for every kit.