4 ms·
> Create the base object, then loop or otherwise control flow over other state to optionally add stuff to the base object. That’s what list comprehensions are
by xigoi 1y ago
> Create the base object, then loop or otherwise control flow over other state to optionally add stuff to the base object.
That’s what list comprehensions are for.
> Then, additionally, the final "build" call can run validations over the set of the complete object.
The constructor function can do that too.
- acedTrex 1y agoThe constructor can not do it because the constructor does not have all the data. This is lazy evaluation.