Design principles: no bool arguments
stefan_ml at behnel.de
Thu Aug 25 19:01:22 CEST 2011
Thomas 'PointedEars' Lahn, 25.08.2011 11:29:
> Stefan Behnel wrote:
>> It's totally unreadable to find this in the code:
>> data1.merge_with(data2, true);
>> Requires you to either a) know the underlying signature by heart, or b)
>> look it up before understanding the code.
>> It's a lot harder to argue against this:
>> data1.merge_with(data2, overwrite_duplicates=True)
> And you will still have to know the underlying signature to name the
> argument. Worse, with keyword arguments you *have to* look up the
> documentation (i. e., it needs to be well-documented as well) to know its
> name (as the compiler can only tell you "kwargs").
Note that code is read more often than it gets written.
More information about the Python-list