A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2009-June/089802.html below:

[Python-Dev] syntax warnings don't go through warnings.warn?

[Python-Dev] syntax warnings don't go through warnings.warn? [Python-Dev] syntax warnings don't go through warnings.warn?Dino Viehland dinov at microsoft.com
Mon Jun 1 18:50:19 CEST 2009
I'm just a little surprised by this - Is there a reason why syntax warnings are special and untrappable via warnings.warn?

>>> import warnings
>>> def mywarn(*args): print 'xx', args
...
>>> warnings.warn = mywarn
>>> compile("def f():\n    a = 1\n    global a\n", "", "exec")
:3: SyntaxWarning: name 'a' is assigned to before global declaration
<code object <module> at 012DB410, file "", line 1>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20090601/1e0511ea/attachment.htm>
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4