spyder-ide / ux-improvements

Discussion about UX improvements for Spyder 5 and beyond
4 stars 2 forks source link

[ discussion / gui enhancement proposal ] "size" field in variable explorer #37

Open iurisegtovich opened 3 years ago

iurisegtovich commented 3 years ago

Issue Report Checklist

Problem Description

Are there any current discussion on the "size" field in variable explorer? I am using spyder in undergraduate teaching and I find that size/len/shape are a common source of human error, kind of hard concept for new students to grasp.

What steps reproduce the problem?

  1. inspect scalars, lists, and nd arrays in the variable explorer, think about the "size" header

What is the expected output? What do you see instead?

I think it would useful if spyder could show the difference betwenn the "size" of a scalar "x=1" and the size of a one element list "y=[1]" for example, i would suggest changing the word "size" for "shape" in the variable explorer header, and using np.shape internally, which gives naturally "()" for x and "(1,)" for y. even if x and y are python vanilla integer and lists, respectively (not np.int64 or np.narray).

also, when opening z=np.array([1,2,3]) in the variable explorer, as it has ndim=1, it would be clearer to omit the "0" indicating it has a column 0, when in fact it has no columns because it has only one dimension, not 2.

i believe this two modifications might make data structures clearer for new students and new professionals when using spyder, help these people not make the usual errors:

  • IndexError: too many indices for array
  • IndexError: invalid index to scalar variable.
  • ValueError: setting an array element with a sequence.
  • expecting that after x=np.array([1,2,3]); x @ x.T and x.T @ x would yield different results

Paste Traceback/Error Below (if applicable)


PASTE TRACEBACK HERE

does not apply

Versions

i assume this behavior is present in current versions as it is displayed in https://docs.spyder-ide.org/current/variableexplorer.html

Dependencies

PASTE DEPENDENCIES HERE
steff456 commented 3 years ago

Hi @iurisegtovich,

Thanks for bringing up all these ideas we can definitely discuss and implement some of them. Right now I'm going to transfer this issue to the ux improvements repo so we can discuss these improvements with all the team.