If I try to run .ls
in python, not surprisingly I get a SyntaxError
>>> .ls
File "<stdin>", line 1
.ls
^
SyntaxError: invalid syntax
But if I import PyROOT, it somehow makes this syntax legal (and behaves as it does in ROOT, listing the contents of the current file; in the example here I haven't opened any.)
>>> import ROOT
>>> .ls
>>>
Similarly, .q
works to quit the Python interpreter after I've imported ROOT, as it does in the normal ROOT interpreter.
How does this work?