Changing calling sequence

2QdxY4RzWzUUiLuE at potatochowder.com 2QdxY4RzWzUUiLuE at potatochowder.com
Sat May 14 19:34:23 EDT 2022


On 2022-05-15 at 10:22:15 +1200,
dn <PythonList at DancesWithMice.info> wrote:

> That said, a function which starts with a list of ifs-buts-and-maybes*
> which are only there to ascertain which set of arguments have been
> provided by the calling-routine; obscures the purpose/responsibility
> of the function and decreases its readability (perhaps not by much,
> but varying by situation).

Agreed.

> Accordingly, if the function is actually a method, recommend following
> @Stefan's approach, ie multiple-constructors. Although, this too can
> result in lower readability.

(Having proposed that approach myself (and having used it over the
decades for functions, methods, procedures, constructors, ...), I also
agree.)

Assuming good names,¹ how can this lead to lower readability?  I guess
if there's too many of them, or programmers have to start wondering
which one to use?  Or is this in the same generally obfuscating category
as the ifs-buts-and-maybes at the start of a function?

¹ and properly invalidated caches


More information about the Python-list mailing list