ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 21 Feb 2016 16:09:15 +0100Does "map" destroy its input?https://ask.sagemath.org/question/32613/does-map-destroy-its-input/I write the following in the SageMath cloud:
Bob="xyz"
sB = subsets(Bob)
print map(str, sB)
print map(str, sB)
and the output is:
['[]', "['x']", "['y']", "['x', 'y']", "['z']", "['x', 'z']", "['y', 'z']", "['x', 'y', 'z']"]
[]
I.e, after the first "map", the variable "sB" becomes empty!
Why does this happen?
Erel Segal-HaleviSun, 21 Feb 2016 16:09:15 +0100https://ask.sagemath.org/question/32613/