Previous Mail concerning Suppressing Context Printing
- To: mathgroup at yoda.physics.unc.edu
- Subject: Previous Mail concerning Suppressing Context Printing
- From: Scott Herod <sherod at picard.colorado.edu>
- Date: Thu, 19 Nov 92 16:52:39 -0700
I sent a note a little while ago about trying to get a package to print
variables. The real question should have been, "How can I suppress the
printing of the context of a variable?" Bruce Fast sent the following
suggestion which works.
Trick the printing routine into seeing the `Private` context.
___________________________________________________________
BeginPackage["MyPackage`"]
tnirP::usage = "Look at it yourself!"
f::usage = "This is the variable."
Begin["`Private`"]
f = myname;
tnirP[anything_] := Module[{},
$ContextPath = Prepend[$ContextPath, "MyPackage`Private`"];
Print[f];
$ContextPath = Delete[$ContextPath, 1];
Null]
End[]
EndPackage[]
_________________________________________________________
Scott Herod