CLN/DOC: cache_readonly: remove allow_setting + preserve docstring
State: closed

Closes https://github.com/pandas-dev/pandas/issues/18197

This kind of 'works' in that `?` or `__doc__` now give the correct docstring, but it's not yet fully ideal as it is now seen as a class (which will probably mess up sphinx' autodoc/autosummary, which I didn't check yet)

Labels:
name: Docs
name: Clean

Comments:
@jreback the `cache_readonly` property now has the `allow_setting` option, which is only used for `Index.is_unique`. But this is actually not used anymore internally (it was used for the default index, see https://github.com/pandas-dev/pandas/commit/8c08acaef77e3b901dcbe09b612de785b0c5e782, but that is now a range index). Do you mind me removing it?
yeah i think can remove that
Another thing, a test is failing for  (with `ind` being an Index):

```
ind.view(np.ndarray).view(Index)

```

but I think this stems from the time that Index was an array subclass. As this now raises an error (with this PR, because `pd.Index.dtype` no longer returns None but an instance of the cached property), while before it was just silently returning garbage.
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/19991?src=pr&el=h1) Report
> :exclamation: No coverage uploaded for pull request base (`master@aedbd94`). [Click here to learn what that means](https://docs.codecov.io/docs/error-reference#section-missing-base-commit).
> The diff coverage is `100%`.

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

```diff
@@            Coverage Diff            @@
##             master   #19991   +/-   ##
=========================================
  Coverage          ?   91.66%           
=========================================
  Files             ?      150           
  Lines             ?    49065           
  Branches          ?        0           
=========================================
  Hits              ?    44974           
  Misses            ?     4091           
  Partials          ?        0
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.04% <100%> (?)` | |
| #single | `41.88% <100%> (?)` | |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/19991?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/indexes/base.py](https://codecov.io/gh/pandas-dev/pandas/pull/19991/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9iYXNlLnB5) | `96.66% <100%> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/19991?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/19991?src=pr&el=footer). Last update [aedbd94...7e7bd8e](https://codecov.io/gh/pandas-dev/pandas/pull/19991?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

@jreback any comments ?
lgtm (just maybe quick check that perf is ok - iow caching behavior is still preserved) 
Did some manual timeits on a cache attribute (Index.hasnans), and once it is cached seeing a small slowdown from ca 85 ns to ca 95 ns. Not sure if this is actually related to this, but since this is about 10 nanoseconds, this doesn't seem a problem.