API: change default for sep in str.cat (in docstring)
State: closed

In the course of #22725, @WillAyd mentioned (about the `sep=None` in `Series.str.cat` being immediately overwritten by `sep = '' if sep is None else sep`):
> Not anything you need to change in this PR but if we just overwrite `None` here it would probably make more sense to change the default function signature to simply be `''`

This changes the default accordingly. Not sure this even needs a deprecation cycle? It's a pretty trivial change, and I doubt there are people relying on `sep=None` explicitly.


Labels:
name: API Design
name: Strings
description: String extension data type and string data

Comments:
Hello @h-vetinari! Thanks for submitting the PR.

 - There are no PEP8 issues in the file [`pandas/core/strings.py`](https://github.com/h-vetinari/pandas/blob/5e2bd40d98e386192c96f7d25e063ce585c9d0f3/pandas/core/strings.py) !


# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/23443?src=pr&el=h1) Report
> Merging [#23443](https://codecov.io/gh/pandas-dev/pandas/pull/23443?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/d78bd7a65f87022bae5021d36c8656c0ea5a7b76?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/23443/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/23443?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master   #23443   +/-   ##
=======================================
  Coverage   92.23%   92.23%           
=======================================
  Files         161      161           
  Lines       51197    51197           
=======================================
  Hits        47220    47220           
  Misses       3977     3977
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.61% <ø> (ø)` | :arrow_up: |
| #single | `42.27% <ø> (ø)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/23443?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/strings.py](https://codecov.io/gh/pandas-dev/pandas/pull/23443/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc3RyaW5ncy5weQ==) | `98.58% <ø> (ø)` | :arrow_up: |
| [pandas/core/indexes/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/23443/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZXMucHk=) | `96.41% <0%> (ø)` | :arrow_up: |
| [pandas/core/indexes/api.py](https://codecov.io/gh/pandas-dev/pandas/pull/23443/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9hcGkucHk=) | `99% <0%> (ø)` | :arrow_up: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/23443/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.03% <0%> (ø)` | :arrow_up: |
| [pandas/core/generic.py](https://codecov.io/gh/pandas-dev/pandas/pull/23443/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ2VuZXJpYy5weQ==) | `96.81% <0%> (ø)` | :arrow_up: |
| [pandas/core/arrays/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/23443/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2RhdGV0aW1lcy5weQ==) | `98.84% <0%> (ø)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/23443?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/23443?src=pr&el=footer). Last update [d78bd7a...2d1bf05](https://codecov.io/gh/pandas-dev/pandas/pull/23443?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

Given that we were setting `sep` to the empty string under-hood, surfacing it explicitly as the default seems reasonable and wouldn't require a deprecation cycle.
@jreback 
> I think just adding the doc-string update is enough. we commondly accept none, then actuall do this check here. The reason is if you actually pass None your change will fail (pls add a test to check that)

How about the following - I went with re-adding the `sep is None` check, but emitting a warning. That will definitely not break anything, and emission of the warning should be very rare (as I believe hardly anyone will be passing `sep=None` directly).
@jreback 
> there is likely some other check for `sep is None` in the codebase, this shouldn't pass, and as I said pls change back to the original modulo the doc-string.

What check for `sep is None` do you imagine there would be? It's not in the code of `str.cat` itself, but I guess I don't understand what you mean.
thanks!