Repository: spyder-ide/spyder

Issue:
Array editor: Change default float formatter from %.3f to %.6g
Currently this array:
```
a = np.array([3.2e-9,45.6e56,22.3,57666.6,0.00000004])
```
looks like this in the array editor with the default %.3f formatting:

![%.3f](https://user-images.githubusercontent.com/10513354/27760319-cb3428d0-5e01-11e7-8e29-48532b8a7e59.png)

I can't tell what most of those numbers are.

But it could look like this with %.6g formatting:

![screenshot from 2017-07-01 02-04-30](https://user-images.githubusercontent.com/10513354/27760323-e81c03aa-5e01-11e7-9862-8664a746c51c.png)

If you think this is a good idea I should be able to do a PR.




Discussion:

Resolving patch:
diff --git a/spyder/config/main.py b/spyder/config/main.py
--- a/spyder/config/main.py
+++ b/spyder/config/main.py
@@ -166,8 +166,8 @@
             ('variable_explorer',
              {
               'check_all': CHECK_ALL,
-              'dataframe_format': '.3g', # no percent sign to avoid problems
-                                         # with ConfigParser's interpolation
+              'dataframe_format': '.6g',  # No percent sign to avoid problems
+                                          # with ConfigParser's interpolation
               'excluded_names': EXCLUDED_NAMES,
               'exclude_private': True,
               'exclude_uppercase': True,
@@ -633,7 +633,7 @@
 #    or if you want to *rename* options, then you need to do a MAJOR update in
 #    version, e.g. from 3.0.0 to 4.0.0
 # 3. You don't need to touch this value if you're just adding a new option
-CONF_VERSION = '40.0.0'
+CONF_VERSION = '40.1.0'
 
 # Main configuration instance
 try:
diff --git a/spyder/widgets/variableexplorer/arrayeditor.py b/spyder/widgets/variableexplorer/arrayeditor.py
--- a/spyder/widgets/variableexplorer/arrayeditor.py
+++ b/spyder/widgets/variableexplorer/arrayeditor.py
@@ -42,15 +42,15 @@
 
 # Note: string and unicode data types will be formatted with '%s' (see below)
 SUPPORTED_FORMATS = {
-                     'single': '%.3f',
-                     'double': '%.3f',
-                     'float_': '%.3f',
-                     'longfloat': '%.3f',
-                     'float16': '%.3f',
-                     'float32': '%.3f',
-                     'float64': '%.3f',
-                     'float96': '%.3f',
-                     'float128': '%.3f',
+                     'single': '%.6g',
+                     'double': '%.6g',
+                     'float_': '%.6g',
+                     'longfloat': '%.6g',
+                     'float16': '%.6g',
+                     'float32': '%.6g',
+                     'float64': '%.6g',
+                     'float96': '%.6g',
+                     'float128': '%.6g',
                      'csingle': '%r',
                      'complex_': '%r',
                      'clongfloat': '%r',
@@ -119,7 +119,7 @@ class ArrayModel(QAbstractTableModel):
     ROWS_TO_LOAD = 500
     COLS_TO_LOAD = 40
 
-    def __init__(self, data, format="%.3f", xlabels=None, ylabels=None,
+    def __init__(self, data, format="%.6g", xlabels=None, ylabels=None,
                  readonly=False, parent=None):
         QAbstractTableModel.__init__(self)
 
diff --git a/spyder/widgets/variableexplorer/dataframeeditor.py b/spyder/widgets/variableexplorer/dataframeeditor.py
--- a/spyder/widgets/variableexplorer/dataframeeditor.py
+++ b/spyder/widgets/variableexplorer/dataframeeditor.py
@@ -45,7 +45,7 @@
 _bool_false = ['false', '0']
 
 # Default format for data frames with floats
-DEFAULT_FORMAT = '%.3g'
+DEFAULT_FORMAT = '%.6g'
 
 # Limit at which dataframe is considered so large that it is loaded on demand
 LARGE_SIZE = 5e5


Test patch:
diff --git a/spyder/app/tests/test_mainwindow.py b/spyder/app/tests/test_mainwindow.py
--- a/spyder/app/tests/test_mainwindow.py
+++ b/spyder/app/tests/test_mainwindow.py
@@ -949,6 +949,8 @@ def test_varexp_magic_dbg(main_window, qtbot):
 
 
 @flaky(max_runs=3)
+@pytest.mark.skipif(os.environ.get('CI', None) is None,
+                    reason="It's not meant to be run outside of a CI")
 def test_fileswitcher(main_window, qtbot):
     """Test the use of shorten paths when necessary in the fileswitcher."""
     # Load tests files
diff --git a/spyder/widgets/variableexplorer/tests/test_arrayeditor.py b/spyder/widgets/variableexplorer/tests/test_arrayeditor.py
--- a/spyder/widgets/variableexplorer/tests/test_arrayeditor.py
+++ b/spyder/widgets/variableexplorer/tests/test_arrayeditor.py
@@ -45,7 +45,7 @@ def test_arrayeditor_format(qtbot):
     qtbot.keyClick(dlg.arraywidget.view, Qt.Key_Down, modifier=Qt.ShiftModifier)
     qtbot.keyClick(dlg.arraywidget.view, Qt.Key_Down, modifier=Qt.ShiftModifier)
     contents = dlg.arraywidget.view._sel_to_text(dlg.arraywidget.view.selectedIndexes())
-    assert contents == "1.000\n2.000\n"
+    assert contents == "1\n2\n"
     dlg.arraywidget.view.model().set_format("%.18e")
     assert dlg.arraywidget.view.model().get_format() == "%.18e"
     qtbot.keyClick(dlg.arraywidget.view, Qt.Key_Down, modifier=Qt.ShiftModifier)