I would like to print just the warning messages in python rather than the message and the code similar to what has been asked in this question: Python: Print only the message on warnings
The solutions to the above question suggest that one can replace the implementation of the warnings.showwarnings()
function with a implementation of their own (monkeypatching) to achieve that goal.
Would it not be easier to just write to stderr
instead? Are there reasons to choose the warnings
module over simply writing to stderr
?