What is print? A function?
Frans Englich
frans.englich at telia.com
Sun Jan 23 13:01:50 EST 2005
Nah, I don't think it's a function, but rather a builtin "statement". But it's
possible to invoke it as an function; print( "test" ) works fine.
So I wonder, what _is_ exactly the print statement? The untraditional way of
invoking it(without paranteses) makes me wonder.
The reason I thinks about this is I need to implement a debug print for my
program; very simple, a function/print statement that conditionally prints
its message whether a bool is true. Not overly complex.
I tried this by overshadowing the print keyword, but that obviously didn't
work.. Is defining a two-liner function the right way to go, or is there
better ways to approach it?
Cheers,
Frans
More information about the Python-list
mailing list