4
$\begingroup$

Bug introduced in 10.0 and fixed in 10.1


Why is the variable a ending up assigned to {1,2,3} after executing

Module[{a},
a=Range[3];
ListPlot[a]
]
$\endgroup$
  • 4
    $\begingroup$ What version are you using? I've tried this on Windows M9 and M10 and don't see the issue. $\endgroup$ – Andy Ross Nov 19 '14 at 3:23
  • $\begingroup$ I am using Mathematica 10 in OS X Yosemite. $\endgroup$ – Daniel Chess Nov 19 '14 at 5:38
  • $\begingroup$ I cannot reproduce this in M10.0.1.0 on OS X 10.9.5 $\endgroup$ – Marius Ladegård Meyer Nov 19 '14 at 6:31
  • $\begingroup$ I can reproduce this on "10.0 for Mac OS X x86 (64-bit) (September 10, 2014)" using OS X Yosemite. Must be a platform-specific bug. You should report it to WRI. $\endgroup$ – Andy Ross Nov 19 '14 at 14:52
  • $\begingroup$ @MichaelE2 It's not. One more problem caused by the Suggestions Bar. $\endgroup$ – Szabolcs Feb 17 '15 at 20:37
6
$\begingroup$

This is yet another bug caused by the Suggestions Bar.

Workaround:

  • Go to Preferences... -> Interface, and uncheck "Show Suggestions Bar after last output".

I can reproduce it on OS X, Mathematica 10.0.2, but not in version 9.0.1.


Whenever I see that some people can reproduce a bug, some can't, I turn on the Suggestion Bar and check if it's the culprit. Very often it is. That's why I keep it off.

$\endgroup$
  • 2
    $\begingroup$ A-ha! I turned off the Suggestions Bar long ago as soon as I found out that I could. I did not realize it also had such a side effect. Its popping in and out of existence is enough of a headache for me. +1 $\endgroup$ – Michael E2 Feb 17 '15 at 22:07
0
$\begingroup$

Very strange!

If you put an "a" after it works as expected:

Module[{a}, a = Range[3];
 ListPlot[a]]
a

It also works if you suppress the Module's output (but not ListPlot's):

Module[{a}, a = Range[3];
  Print@ListPlot[a]];
$\endgroup$
  • 1
    $\begingroup$ This is yet another symptom of Sugestions Bar caused trouble. Putting the a at the end prevents the Suggestions Bar from messing with the previous output. $\endgroup$ – Szabolcs Feb 17 '15 at 20:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.