I just got the bright idea of doing:
def debug(obj, f = FILE, l = LINE)
print f, ‘:’, l, ‘:’
pp(obj)
end
But it doesn’t work, either. Apparently, the default args are filled in
in the method scope. Maybe that is predictable, I was hoping to have
the defaults be filled in in my caller’s scope, though. And this version
loses the ability to print multpile objects.
Any other ideas?
Quoteing sroberts@uniserve.com, on Sun, Mar 07, 2004 at 04:29:36AM +0900:
···
I want a version of “pp” that prints the file/line, so I tried this:
def debug(*objs)
print FILE, ‘:’, LINE, ‘:’
pp(*objs)
endObviously, this doesn’t work, it always gives the file/line of
debug()…How do I get my callers LINE and FILE?
And yes, I know there are half-dozen debug/log printers on RAA… but
none seem to have the combination I want:
- to have printed expressions be formatted with PP
- to have the file/line in the output
or am I wrong? I don’t need to reinvent this particular wheel!
Sam