COMPAT: Use actual isinstance check for pyarrow.Array instead of hasattr(.. 'type') duck typing
PR for the suggestion I made at https://github.com/pandas-dev/pandas/pull/52076/files#r1160653924

seems reasonable In https://github.com/pandas-dev/pandas/pull/52833 I need a similar check, but in cython. So if we do that, we can probably only define it in cython instead of in `compat/pyarrow.py` Moved it to cython given that we will likely need pyarrow in lib.pyx anyway (eg needed for https://github.com/pandas-dev/pandas/pull/52833 as well) Can you be more specific? Which other specific checks are you thinking about? (beyond one of the main pyarrow classes) Possibly pyarrow Table and Scalars too. There might be a use case for checking for specific Scalar or Array subclasses too? I was referring to checks like, checking for an array/scalar and afterwards checking for a specific pyarrow type (int, ...). This would require helper functions for all checks we might want > I was referring to checks like, checking for an array/scalar and afterwards checking for a specific pyarrow type (int, ...). This would require helper functions for all checks we might want

IIUC most of these would be relevant when we already have an ArrowExtensionArray and want to check if a scalar can be held in an array of that dtype, e.g. for setitem-with-expansion.  Most of our EAs have something like this, either _validate_scalar or _validate_setitem_value.  I think the way forward is to standardize this, so the relevant check would go on ArrowExtensionArray and we wouldn't need to worry about these helpers @phofl OK to move forward here (pending green)? Yep @jorisvandenbossche can you merge main and ping on green @jbrockmendel mypy is not happy with my attempt to add a type guard:

```
mypy.....................................................................Failed
- hook id: mypy
- duration: 132.62s
- exit code: 1

pandas/_libs/lib.pyi:46: error: Variable "pandas._typing.ArrowArrayTypeGuard" is not valid as a type  [valid-type]
pandas/_libs/lib.pyi:46: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
Found 1 error in 1 file (checked 1417 source files)
```
(and I can't directly seem to fix it)

OK with leaving the typing part out for a follow-up PR? (I can directly open one with what I tried here, so we can discuss the best approach with the typing experts)
 > OK with leaving the typing part out for a follow-up PR? (I can directly open one with what I tried here, so we can discuss the best approach with the typing experts)

sounds good thanks @jorisvandenbossche 