Adding an attribute to a function is easy and clearing attribute is easy also. But I don't know really how to restore the attributes of a function to its defaults. All I do is quit the kernel or close Mathematica and open again.
any idea?
Update
For example :
Log // Attributes
(* {Listable, NumericFunction, Protected} *)
ClearAttributes[Log, Listable]
Log // Attributes
(* {NumericFunction, Protected} *)
Now is there any way to restore the attributes of Log to its defaults other than SetAttributes or quitting Mathematica?
Thanks.
Answer
If you have not saved the attributes before changing them, and also can't quit the Kernel, then you could launch a Subkernel and get the original attributes that way:
ClearAttributes[Log, Listable]
Attributes[Log]
{NumericFunction, Protected}
First@ParallelEvaluate[Attributes[Log]]
{Listable,NumericFunction,Protected}
Comments
Post a Comment