Jonathan Fine writes:
I'm thinking of providing a builtin debug() command
"Command" doesn't make much sense in this context. I presume you mean "function".
that 'does the right thing' according to the context. And the context would include the user's preferences. Which might be to use the print command in your devtools package.
"Do what I mean" is inappropriate for a built-in because you have no idea who might be calling it. I can see an API (say, that of class Pdb ;-) and various implementations (starting with Pdb and finally evolving as Jonathan Fine's Magic Mind-Reading Debugging Environment). Wait, wut???!!! Look here:
I suggest the builtin debug() would determine the API, and provide a reference implementation. And that many users (perhaps through their IDE) would choose a different implementation.
The necessary builtin for this is already available. Its name is "breakpoint".