Repository: numpy/numpy

Issue:
BUG: Missing linspace import breaks concatenation funcs
In #12057 the linspace is removed from the imports from `core` however this broke various concatenation code in SciPy. The AxesConcetananenantatotator (it's impossible to type) has a method call specifically for linspace and hence trips up.

https://github.com/numpy/numpy/blob/872372bd56ccb5fe98faae8be7d14e4a8c69e037/numpy/lib/index_tricks.py#L349


There are other backwards incompatible changes for `hstack` and `column_stack` which were explicitly accepting generator expressions but now they don't. 

Xref : scipy/scipy#9405


### Reproducing code example:

The simplest would be 

```python
>>> import numpy as np
>>> np.r_[0:36:100j]
```

### Error message:

```
Traceback (most recent call last):

  File "<ipython-input-62-500dc46d81ee>", line 1, in <module>
    np.r_[0:5:10j]

  File "c:\...\appdata\local\programs\python\python36\lib\site-packages\numpy-1.16.0.dev0+872372b-py3.6-win-amd64.egg\numpy\lib\index_tricks.py", line 349, in __getitem__
    newobj = function_base.linspace(start, stop, num=size)

AttributeError: module 'numpy.lib.function_base' has no attribute 'linspace'
```

### Numpy/Python version information:

<!-- Output from 'import sys, numpy; print(numpy.__version__, sys.version)' -->

```
1.16.0.dev0+872372b 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)]
```


Discussion:
@shoyer Any chance that `__array_function__` broke functions that once accepted generators?
@charris yes, that part is definitely due to `__array_function__` refactoring. Let's split that discussion off to https://github.com/numpy/numpy/issues/12263 and keep this one focused on breakage due to the removed imports.

Resolving patch:
diff --git a/numpy/lib/index_tricks.py b/numpy/lib/index_tricks.py
--- a/numpy/lib/index_tricks.py
+++ b/numpy/lib/index_tricks.py
@@ -10,11 +10,10 @@
     )
 from numpy.core.numerictypes import find_common_type, issubdtype
 
-from . import function_base
 import numpy.matrixlib as matrixlib
 from .function_base import diff
 from numpy.core.multiarray import ravel_multi_index, unravel_index
-from numpy.core import overrides
+from numpy.core import overrides, linspace
 from numpy.lib.stride_tricks import as_strided
 
 
@@ -346,7 +345,7 @@ def __getitem__(self, key):
                     step = 1
                 if isinstance(step, complex):
                     size = int(abs(step))
-                    newobj = function_base.linspace(start, stop, num=size)
+                    newobj = linspace(start, stop, num=size)
                 else:
                     newobj = _nx.arange(start, stop, step)
                 if ndmin > 1:


Test patch:
diff --git a/numpy/lib/tests/test_index_tricks.py b/numpy/lib/tests/test_index_tricks.py
--- a/numpy/lib/tests/test_index_tricks.py
+++ b/numpy/lib/tests/test_index_tricks.py
@@ -226,6 +226,11 @@ def test_more_mixed_type(self):
         g = r_[-10.1, np.array([1]), np.array([2, 3, 4]), 10.0]
         assert_(g.dtype == 'f8')
 
+    def test_complex_step(self):
+        # Regression test for #12262
+        g = r_[0:36:100j]
+        assert_(g.shape == (100,))
+
     def test_2d(self):
         b = np.random.rand(5, 5)
         c = np.random.rand(5, 5)