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]
]
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityBug 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]
]
This is yet another bug caused by the Suggestions Bar.
Workaround:
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.
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]];
a
at the end prevents the Suggestions Bar from messing with the previous output.
$\endgroup$