CLN refactor core/arrays
Some refactorings found by Sourcery https://sourcery.ai/

I've removed the ones of the kind
```diff
- if param:
-     var = a
- else:
-     var = b
+ var = a if param else b
```
this is failing checks > this is failing checks

Yes, the change
```diff
-        for i in range(len(self)):
-            yield self[i]
+        yield from self
```
was throwing a RecursionError thanks @MarcoGorelli 