How do you get rid of useless warnings?

Peter Otten __peter__ at web.de
Tue Oct 7 12:59:20 EDT 2008


Grant Edwards wrote:

> I'm getting awfully tired of constant warnings about what's
> going to happen at some point in the future.
> 
> Warnings like this:
> 
> ./surfplot.py:313: Warning: 'with' will become a reserved keyword in
> Python 2.6

The "with" and "as" warnings bypass the warning mechanism. The only way I
can see to avoid them is to compile the python code:

$ cat warnwith.py
with = 42
$ python warnwith.py
warnwith.py:1: Warning: 'with' will become a reserved keyword in Python 2.6
$ python -c "import warnwith"
warnwith.py:1: Warning: 'with' will become a reserved keyword in Python 2.6
$ python warnwith.pyc

Peter





More information about the Python-list mailing list