Signatures, a call to action

I think the maxsplit case is fine. -1 is a nice, obvious “magic value” that we can use if we need to explicitly force the default value.

But the index case is horrific. It offends my aesthetic sensibilities and makes me die a little bit inside every time I see it.

It would be a little bit better if it could be displayed as stop=2**63 - 1 but even that is too complicated to make a good “nice, obvious magic value” suitable as a default.

There are many cases where None makes an excellent “nice, obvious magic value” for defaults, but I’m not certain that logs are one.

I know this is subjective, but having base=None for the default just looks and feels weird to me. I could live with it, but if I were writing my own log function, I’d use a different magic value.

Oh look, I actually did :wink:


def log_star(x, base=0):

    """log_star(x)



    Return the iterated logarithm log*(x) to some base.



    If the base	is missing or 0, the natural log is used.          

    """

    # FIXME: base must be > e**(1/e)

    if x <= 1:

   	    return 0

    elif base == 0:

        return 1 + log_star(math.log(x))

    else:

        return 1 + log_star(math.log(x, base), base)

I could live with a default of None for the base, but I think that using 0 as the magic value is nicer and less weird.