# Signatures, a call to action

**URL:** <https://discuss.python.org/t/signatures-a-call-to-action/23580>\
**Category:** Core Development\
**Created:** [February 6, 2023, 3:23am UTC](https://discuss.python.org/t/signatures-a-call-to-action/23580 "2023-02-06T03:23:34Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![steven.daprano](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/steven.daprano/32/1083_2.png) [@steven.daprano](https://discuss.python.org/u/steven.daprano)\
**Post date:** [February 6, 2023, 11:04am UTC](https://discuss.python.org/t/signatures-a-call-to-action/23580/12 "2023-02-06T11:04:50Z")

</div>

> [@rhettinger](#):
>
> The list.index() method … help now reads:
> 
> ```
> index(self, value, start=0, stop=9223372036854775807, /)
> 
> ```
> 
> Yuck, how did these implementation details leak into the language? Likewise, str.split() got altered to use a -1 magic constant. Its help now reads:
> 
> ```
> split(self, /, sep=None, maxsplit=-1)
> 
> ```
> 
> That’s a bummer because documentation modeling language formerly used in help() is clearer:
> 
> ```
> str.split([sep[, maxsplit]])
> 
> ```

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.

> [@Should \`None\` defaults for optional arguments be discouraged?](https://discuss.python.org/t/should-none-defaults-for-optional-arguments-be-discouraged/23554/11):
>
> I also agree with Guido:
> 
> > [@Should \`None\` defaults for optional arguments be discouraged?](https://discuss.python.org/t/should-none-defaults-for-optional-arguments-be-discouraged/23554/11):
> >
> > Contrary to most reactions, I find it natural and desirable to accept `None` as an alternative to omit an optional parameter in a wide variety of APIs. Not because I like to read or write `log(2.3, None)` but because I like to be able to define a simple wrapper, e.g.

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 😉

```python

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.

---

_[View the full topic](https://discuss.python.org/t/signatures-a-call-to-action/23580)._
