numpy/numpy — pull request #4845 by ddasilva (2014-07-06 18:44:48+00:00)
Title: ENH: Introduce np.arr array creation in `numpy.mat` style. Fixes #4817.

Introduces `np.arr(s)` which uses a utility function from ``numpy.mat`` to implement array creation in `numpy.mat` style. In #4817 @frozen-flame suggested this in light that it would be beneficial to beginners and presenters during demonstrations.

Examples:

>>> np.arr('3; 4; 5')
array([[3],
[4],
[5]])

>>> np.arr('3; 4; 5', dtype=float)
array([[ 3.],
[ 4.],
[ 5.]])

>>> np.arr('1 0 0; 0 1 0; 0 0 1')
array([[1, 0, 0],
[0, 1, 0],
[0, 0, 1]])

>>> np.arr('4, 5; 6, 7')
array([[4, 5],
[6, 7]])