On May 10, 6:56 pm, Steven D'Aprano <st...@remove-this-
cybersource.com.au> wrote:
> > 4. What's the python way to emit warnings?  (The script below should
> >    warn the user that arguments after the first one are ignored.)
>
> import warnings
> warnings.warn("The end of the world is coming!")

The warnings module is used for warnings about program code, not user
input.

import logging
logging.warn("Oh noes, you passed me two arguments instead of one!")

--
Marius Gedminas
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to