Hi all

So I was curious about the latest "idea" on aiding array input in spyder in 
the Editor and I gave it a quick go. I moved the thread here, so that the 
other one (where this started) can remain for the original purpose.

Now, back to the Numpy/Array/Matrix helper.

You can check the work here 
<https://bitbucket.org/goanpeca/spyderlib-dev/branch/array>:

If you want to try it:

hg clone https://[email protected]/goanpeca/spyderlib-dev spyder-array
cd spyder-array
hg pull && hg update array
python bootstrap.py

The idea is still on the drawing board but it works like this.

The "numpy array helper" gets called in the editor with Control+M. 
A small dialog appears in the cursor position and you can enter either a 
Matrix or an Array in simplified (Matlab?) format.

If you hit enter, it transforms (reformats) the text to become an array. If 
you hit control enter, it will reformat to handle the matrix case. I 
removed extra spaces, and handle the case of including or not brackets....

so...

*Case 1.)*
[1 2;3 2]  or  [1   2  ;  3 2] or 1 2;3 2 or 1 2;   3    2     Enter will 
produce

np.array([[1, 2], [3, 2]])

*Case 2.)*
[1 2;3 2]  or  [1   2  ;  3 2] or 1 2;3 2 or 1 2;   3    2     
Control+Enter will produce

np.matrix([[1, 2], [3, 2]])

I am not checking if it is a valid array or matrix, just playing with the 
string and parsing it. It only produces 2D arrays/matrices... but I guess 
it could be extended further

*Notes:*

   - I am not checking if it is a valid array or matrix, just playing with 
   the string and parsing it. It only produces 2D arrays/matrices... but I 
   guess it could be extended further
   - If the box is empty when you hit enter it does nothing
   - This is for now only being triggered in the editor with a python script


Let me know how it feels :)

Cheers

-- 
You received this message because you are subscribed to the Google Groups 
"spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/spyderlib.
For more options, visit https://groups.google.com/d/optout.

Reply via email to